Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/photo_utils/extensions/float.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#format(precision = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/photo_utils/extensions/float.rb', line 11 def format(precision=nil) '%.*f' % [ (precision.nil? || self < precision) ? 1 : 0, self, ] end |
#prec(x) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/photo_utils/extensions/float.rb', line 3 def prec(x) if self == self.round self else ('%.*f' % [x, self]).to_f end end |