Class: Necromancer::ArrayConverters::ArrayToNumericArrayConverter
- Inherits:
-
Converter
- Object
- Converter
- Necromancer::ArrayConverters::ArrayToNumericArrayConverter
- Defined in:
- lib/necromancer/converters/array.rb
Overview
An object that converts an array to an array with numeric values
Instance Attribute Summary
Attributes inherited from Converter
#config, #convert, #source, #target
Instance Method Summary collapse
-
#call(value, strict: config.strict) ⇒ Object
Convert an array to an array of numeric values.
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 an array to an array of numeric values
128 129 130 131 132 |
# File 'lib/necromancer/converters/array.rb', line 128 def call(value, strict: config.strict) num_converter = NumericConverters::StringToNumericConverter.new(:string, :numeric) value.map { |val| num_converter.(val, strict: strict) } end |