attribute_mapper.rb 621 B

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