Class: FloatTypecaster

Inherits:
Typecaster show all
Defined in:
lib/type_casters.rb

Overview

Casts a value to a float

Instance Method Summary collapse

Methods inherited from Typecaster

registered_typecasters, #typecast_on_write?, typecaster_for

Instance Method Details

#typeObject



46
# File 'lib/type_casters.rb', line 46

def type; 'float' end

#typecast(value) ⇒ Object



48
49
50
# File 'lib/type_casters.rb', line 48

def typecast(value)
  value.to_f
end