Class: Float

Inherits:
Object show all
Defined in:
lib/presenter/types.rb

Class Method Summary collapse

Class Method Details

.typecast(value) ⇒ Object



16
17
18
19
# File 'lib/presenter/types.rb', line 16

def self.typecast(value)
  value_to_f = value.to_f
  value_to_f == 0 && value.to_s !~ /^0*\.?0+/ ? nil : value_to_f
end