Class: Numeric

Inherits:
Object show all
Defined in:
lib/a_types/core_ext/boolean.rb,
lib/a_types/core_ext/numeric.rb

Overview

Numeric Additions.

Instance Method Summary collapse

Instance Method Details

#to_booltrue, false Also known as: to_b, to_bool!, to_b!

Interprets this Numeric to a boolean value.

Returns:

  • (true, false)

    true if this is > 0, false otherwise.



12
13
14
# File 'lib/a_types/core_ext/boolean.rb', line 12

def to_bool
  self > 0 ? true : false
end

#to_numNumeric

Returns itself.

Returns:



18
19
20
# File 'lib/a_types/core_ext/numeric.rb', line 18

def to_num
  self
end