Class: Integer
- Defined in:
- lib/finishing_moves/numeric.rb,
lib/finishing_moves/to_bool.rb
Instance Method Summary collapse
- #length ⇒ Object (also: #digits)
- #to_bool ⇒ Object
Instance Method Details
#length ⇒ Object Also known as: digits
19 20 21 |
# File 'lib/finishing_moves/numeric.rb', line 19 def length Math.log10(self.abs).to_i + 1 end |
#to_bool ⇒ Object
10 11 12 13 14 |
# File 'lib/finishing_moves/to_bool.rb', line 10 def to_bool return true if self == 1 return false if self == 0 raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") end |