attribute_mapper.rb 473 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Common::AttributeMapper < Sequencer::Unit::Base
  3. def self.map
  4. raise "Missing implementation of '#{__method__}' method for '#{name}'"
  5. end
  6. def self.uses
  7. map.keys
  8. end
  9. def self.provides
  10. map.values
  11. end
  12. def process
  13. self.class.map.each do |original, renamed|
  14. state.provide(renamed) do
  15. state.use(original)
  16. end
  17. end
  18. end
  19. end