Class: Fixnum

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

Instance Method Summary collapse

Instance Method Details

#to_boolObject

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/init.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