Class: Numeric

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

Overview

Numeric extensions to calculate round numbers.

Instance Method Summary collapse

Instance Method Details

#ceil_at(*args) ⇒ Object

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.



14
15
16
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 14

def ceil_at(*args)
  to_f.ceil_at(*args)
end

#ceil_to(*args) ⇒ Object

See Float#ceil_to.



20
21
22
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 20

def ceil_to(*args)
  to_f.ceil_to(*args)
end

#floor_at(*args) ⇒ Object

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.



30
31
32
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 30

def floor_at(*args)
  to_f.floor_at(*args)
end

#floor_to(*args) ⇒ Object

See Float#floor_to.



36
37
38
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 36

def floor_to(*args)
  to_f.floor_to(*args)
end

#round_at(*args) ⇒ Object

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.



46
47
48
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 46

def round_at(*args)
  to_f.round_at(*args)
end

#round_to(*args) ⇒ Object

See Float#round_to.



52
53
54
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 52

def round_to(*args)
  to_f.round_to(*args)
end

#truncate_at(*args) ⇒ Object

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.



62
63
64
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 62

def truncate_at(*args)
  to_f.truncate_at(*args)
end

#truncate_to(*args) ⇒ Object

See Float#truncate_to.



68
69
70
# File 'lib/sixarm_ruby_numeric_round/numeric.rb', line 68

def truncate_to(*args)
  to_f.truncate_to(*args)
end