Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/utils.rb

Instance Method Summary collapse

Instance Method Details

#to_boolObject

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'lib/utils.rb', line 22

def to_bool
  return true if self == 1
  return false if self == 0
  raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end