Class: Numeric

Inherits:
#Object show all
Includes:
Comparable
Defined in:
ext/enterprise_script_service/mruby/mrblib/numeric.rb

Overview

Numeric

ISO 15.2.7

Instance Method Summary collapse

Methods included from Comparable

#<, #<=, #==, #>, #>=, #between?, #clamp

Instance Method Details

#+@Object

Returns the receiver simply.

ISO 15.2.7.4.1



11
12
13
# File 'ext/enterprise_script_service/mruby/mrblib/numeric.rb', line 11

def +@
  self
end

#-@Object

Returns the receiver’s value, negated.

ISO 15.2.7.4.2



19
20
21
# File 'ext/enterprise_script_service/mruby/mrblib/numeric.rb', line 19

def -@
  0 - self
end

#absObject

Returns the absolute value of the receiver.

ISO 15.2.7.4.3



27
28
29
30
31
32
33
# File 'ext/enterprise_script_service/mruby/mrblib/numeric.rb', line 27

def abs
  if self < 0
    -self
  else
    self
  end
end