class Necromancer::NumericConverters::StringToFloatConverter

An object that converts a String to a Float

Public Instance Methods

call(value, options = {}) click to toggle source

Convert string to float value

@example

converter.call('1.2') # => 1.2

@api public

# File lib/necromancer/converters/numeric.rb, line 49
def call(value, options = {})
  strict = options.fetch(:strict, config.strict)
  Float(value)
rescue
  strict ? fail_conversion_type(value) : value.to_f
end