source:
EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb@
449
Last change on this file since 449 was 439, checked in by , 4 years ago | |
---|---|
|
|
File size: 199 bytes |
Rev | Line | |
---|---|---|
[439] | 1 | class Numeric |
[331] | 2 | def zero? |
3 | self == 0 | |
4 | end | |
5 | ||
6 | def nonzero? | |
7 | if self == 0 | |
8 | nil | |
9 | else | |
10 | self | |
11 | end | |
12 | end | |
[439] | 13 | |
14 | def positive? | |
15 | self > 0 | |
16 | end | |
17 | ||
18 | def negative? | |
19 | self < 0 | |
20 | end | |
[270] | 21 | end |
Note:
See TracBrowser
for help on using the repository browser.