class Numeric

Numeric extensions to calculate round numbers.

Public Instance Methods

ceil_at(*args) click to toggle source

Conceptually, ceil is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric object. For example, one could ceil an Integer to the nearest kilo.

See Float#ceil_at.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 13
def ceil_at(*args)
  to_f.ceil_at(*args)
end
ceil_to(*args) click to toggle source

See Float#ceil_to.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 19
def ceil_to(*args)
  to_f.ceil_to(*args)
end
floor_at(*args) click to toggle source

Conceptually, floor is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric object. For example, one could floor an Integer to the nearest kilo.

See Float#floor_at.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 29
def floor_at(*args)
  to_f.floor_at(*args)
end
floor_to(*args) click to toggle source

See Float#floor_to.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 35
def floor_to(*args)
  to_f.floor_to(*args)
end
round_at(*args) click to toggle source

Conceptually, round is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric object. For example, one could round an Integer to the nearest kilo.

See Float#round_at.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 45
def round_at(*args)
  to_f.round_at(*args)
end
round_to(*args) click to toggle source

See Float#round_to.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 51
def round_to(*args)
  to_f.round_to(*args)
end
truncate_at(*args) click to toggle source

Conceptually, truncate is expected to apply to floating point numbers. However it can actually be applied to pretty much any Numeric object. For example, one could truncate an Integer to the nearest kilo.

See Float#truncate_at.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 61
def truncate_at(*args)
  to_f.truncate_at(*args)
end
truncate_to(*args) click to toggle source

See Float#truncate_to.

# File lib/sixarm_ruby_numeric_round/numeric.rb, line 67
def truncate_to(*args)
  to_f.truncate_to(*args)
end