attribute_mapper.rb 544 B

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