Class: Integer

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

Instance Method Summary collapse

Instance Method Details

#to_boolObject



4
5
6
7
8
9
# File 'lib/ext/to_bool.rb', line 4

def to_bool
  return true if self == 1
  return false if zero?

  raise "Integer '#{self}' can't be converted to Boolean."
end