Module: N::NumberUtils
- Defined in:
- lib/glue/number.rb
Overview
Implement as a module to avoid class polution. You can still use Ruby’s advanced features to include the module in your class. Passing the object to act upon allows to check for nil, which isn’t possible if you use self.
Class Method Summary collapse
-
.ceil_multiple(num, multiple) ⇒ Object
Returns the multiple ceil of a number.
Class Method Details
.ceil_multiple(num, multiple) ⇒ Object
Returns the multiple ceil of a number
16 17 18 19 20 |
# File 'lib/glue/number.rb', line 16 def self.ceil_multiple(num, multiple) # gmosx: to_f is needed!s # gmosx: IS THERE a more optimized way to do this? return ((num.to_f/multiple).ceil*multiple) end |