Class: Float

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

Overview

Add a rounding method to the Float class.

Instance Method Summary collapse

Instance Method Details

#round_to(x) ⇒ Object


3
4
5
# File 'lib/rvideo/float.rb', line 3

def round_to(x)
  (self * 10**x).round.to_f / 10**x
end