From b5dfbce76702e8ef6891d8a995de405a14b4ee03 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 18 Oct 2017 10:10:37 +0900 Subject: Add `Numeric#{positive?,negative?}`; CRuby2.3 --- mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mrbgems/mruby-numeric-ext') diff --git a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb index 0bf3c6ab6..f250538fe 100644 --- a/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +++ b/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb @@ -14,4 +14,12 @@ module Integral self end end + + def positive? + self > 0 + end + + def negative? + self < 0 + end end -- cgit v1.2.3