trabajo-afectivo/lib/sequencer/unit/import/common/mapping/flat_keys.rb

35 lines
877 B
Ruby
Raw Normal View History

class Sequencer
class Unit
module Import
module Common
module Mapping
class FlatKeys < Sequencer::Unit::Base
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
uses :resource
def process
provide_mapped do
mapped
end
end
private
def mapped
resource_with_indifferent_access = resource.with_indifferent_access
mapping.symbolize_keys.collect do |source, local|
[local, resource_with_indifferent_access[source]]
end.to_h.with_indifferent_access
end
def mapping
raise "Missing implementation of '#{__method__}' method for '#{self.class.name}'"
end
end
end
end
end
end
end