Class: Numeric

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

Instance Method Summary collapse

Instance Method Details

#round_to(precision = nil) ⇒ Object



6
7
8
# File 'lib/rstats.rb', line 6

def round_to(precision=nil)
  precision.nil? ? round : (self * (10 ** precision)).round / (10 ** precision).to_f
end