diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-18 10:10:37 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-10-18 10:10:37 +0900 |
| commit | b5dfbce76702e8ef6891d8a995de405a14b4ee03 (patch) | |
| tree | ed7fae12dd2dcff676a53e8c1ec75ebfafdd4cc8 /mrbgems/mruby-numeric-ext/mrblib | |
| parent | 44f07045d186b2065103c4095b3a2fe56e3964b5 (diff) | |
| download | mruby-b5dfbce76702e8ef6891d8a995de405a14b4ee03.tar.gz mruby-b5dfbce76702e8ef6891d8a995de405a14b4ee03.zip | |
Add `Numeric#{positive?,negative?}`; CRuby2.3
Diffstat (limited to 'mrbgems/mruby-numeric-ext/mrblib')
| -rw-r--r-- | mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb | 8 |
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 |
