Module: DataMaps::Converter
- Extended by:
- DataMaps::Concerns::Factory
- Defined in:
- lib/data_maps/converter/key.rb,
lib/data_maps/converter/map.rb,
lib/data_maps/converter/base.rb,
lib/data_maps/converter/bool.rb,
lib/data_maps/converter/ruby.rb,
lib/data_maps/converter/string.rb,
lib/data_maps/converter/affixes.rb,
lib/data_maps/converter/numeric.rb,
lib/data_maps/converter/for_each.rb
Defined Under Namespace
Classes: Base, Bool, ForEach, Key, Map, Numeric, Postfix, Prefix, Ruby, String
Class Method Summary collapse
-
.create_from_map(mapping) ⇒ Array
Helper method to create converts from a mapping_hash.
Methods included from DataMaps::Concerns::Factory
Class Method Details
.create_from_map(mapping) ⇒ Array
Helper method to create converts from a mapping_hash
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/data_maps/converter/base.rb', line 9 def self.create_from_map(mapping) raise ArgumentError.new('Converter mapping has to be an array') unless mapping.is_a?(Array) mapping.map do |converter| converter = { apply: converter } unless converter.is_a? Hash raise ArgumentError.new('Converter must be specified with the apply key') unless converter.key?(:apply) self.factory(converter[:apply], converter[:option]) end end |