Class: ActiveAttr::Typecasting::FloatTypecaster
- Inherits:
-
Object
- Object
- ActiveAttr::Typecasting::FloatTypecaster
- Defined in:
- lib/active_attr/typecasting/float_typecaster.rb
Overview
Typecasts an Object to a Float
Instance Method Summary collapse
-
#call(value) ⇒ Float?
Typecasts an object to a Float.
Instance Method Details
#call(value) ⇒ Float?
Typecasts an object to a Float
Attempts to convert using #to_f.
22 23 24 |
# File 'lib/active_attr/typecasting/float_typecaster.rb', line 22 def call(value) value.to_f if value.respond_to? :to_f end |