ISO 15.2.7
Returns the receiver simply.
ISO 15.2.7.4.1
# File mrblib/numeric.rb, line 11
def +@
self
end
Returns the receiver's value, negated.
ISO 15.2.7.4.2
# File mrblib/numeric.rb, line 19
def -@
0 - self
end
Returns the absolute value of the receiver.
ISO 15.2.7.4.3
# File mrblib/numeric.rb, line 27
def abs
if self < 0
-self
else
self
end
end
# File mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb, line 18
def negative?
self < 0
end
# File mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb, line 6
def nonzero?
if self == 0
nil
else
self
end
end
# File mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb, line 14
def positive?
self > 0
end