2c4ca0adfa
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.23.0 to 1.24.1. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.23.0...v1.24.1)
42 lines
1.1 KiB
Ruby
42 lines
1.1 KiB
Ruby
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
class Sequencer
|
|
class Unit
|
|
module Import
|
|
module Common
|
|
module Mapping
|
|
class FlatKeys < Sequencer::Unit::Base
|
|
include ::Sequencer::Unit::Import::Common::Mapping::Mixin::ProvideMapped
|
|
prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
|
|
|
|
skip_any_action
|
|
|
|
uses :resource
|
|
provides :mapped
|
|
|
|
def process
|
|
provide_mapped do
|
|
mapped
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def mapped
|
|
@mapped ||= begin
|
|
resource_with_indifferent_access = resource.with_indifferent_access
|
|
mapping.symbolize_keys.to_h do |source, local|
|
|
[local, resource_with_indifferent_access[source]]
|
|
end.with_indifferent_access
|
|
end
|
|
end
|
|
|
|
def mapping
|
|
raise "Missing implementation of '#{__method__}' method for '#{self.class.name}'"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|