Class: Necromancer::NumericConverters::StringToFloatConverter
- Inherits:
-
Converter
- Object
- Converter
- Necromancer::NumericConverters::StringToFloatConverter
- Defined in:
- lib/necromancer/converters/numeric.rb
Overview
An object that converts a String to a Float
Instance Attribute Summary
Attributes inherited from Converter
#config, #convert, #source, #target
Instance Method Summary collapse
-
#call(value, strict: config.strict) ⇒ Object
Convert string to float value.
Methods inherited from Converter
create, #initialize, #raise_conversion_type
Constructor Details
This class inherits a constructor from Necromancer::Converter
Instance Method Details
#call(value, strict: config.strict) ⇒ Object
Convert string to float value
49 50 51 52 53 |
# File 'lib/necromancer/converters/numeric.rb', line 49 def call(value, strict: config.strict) Float(value) rescue StandardError strict ? raise_conversion_type(value) : value.to_f end |