class Necromancer::ArrayConverters::ArrayToNumericConverter

An object that converts an array to an array with numeric values

Public Instance Methods

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

Convert an array to an array of numeric values

@example

converter.call(['1', '2.3', '3.0])  # => [1, 2.3, 3.0]

@param [Array] value

the value to convert

@api public

# File lib/necromancer/converters/array.rb, line 44
def call(value, options = {})
  numeric_converter = NumericConverters::StringToNumericConverter.new(:string, :numeric)
  value.reduce([]) do |acc, el|
    acc << numeric_converter.call(el, options)
  end
end