Class: Fixnum

Inherits:
Object
  • Object
show all
Defined in:
lib/heartwood/support/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#nearest_halfObject



3
4
5
# File 'lib/heartwood/support/fixnum.rb', line 3

def nearest_half
  to_f.nearest_half
end

#to_boolObject

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/heartwood/support/fixnum.rb', line 7

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