Class: Parameters::Types::Float
- Defined in:
- lib/parameters/types/float.rb
Class Method Summary collapse
-
.coerce(value) ⇒ ::Float
The coerces a value into a Float.
Methods inherited from Object
Methods inherited from Type
#<, #<=, #==, ===, #===, #coerce, #to_ruby, to_ruby
Class Method Details
.coerce(value) ⇒ ::Float
The coerces a value into a Float.
16 17 18 19 20 21 22 |
# File 'lib/parameters/types/float.rb', line 16 def self.coerce(value) if value.respond_to?(:to_f) value.to_f else 0.0 end end |