Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/trak/core_ext/round_to_nearest.rb
Instance Method Summary collapse
Instance Method Details
#round_to_nearest(integer = 1) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/trak/core_ext/round_to_nearest.rb', line 2 def round_to_nearest(integer = 1) if integer == 1 self.round else ((self.to_f / integer).round * integer).to_i end end |