summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-10-18 10:10:37 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-10-18 10:10:37 +0900
commitb5dfbce76702e8ef6891d8a995de405a14b4ee03 (patch)
treeed7fae12dd2dcff676a53e8c1ec75ebfafdd4cc8
parent44f07045d186b2065103c4095b3a2fe56e3964b5 (diff)
downloadmruby-b5dfbce76702e8ef6891d8a995de405a14b4ee03.tar.gz
mruby-b5dfbce76702e8ef6891d8a995de405a14b4ee03.zip
Add `Numeric#{positive?,negative?}`; CRuby2.3
-rw-r--r--mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb8
1 files changed, 8 insertions, 0 deletions
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