named.rb 468 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Common::Provider::Named < Sequencer::Unit::Common::Provider::Attribute
  3. module ClassMethods
  4. def named_provide
  5. name.demodulize.underscore.to_sym
  6. end
  7. end
  8. def self.inherited(base)
  9. super
  10. base.extend(ClassMethods)
  11. base.provides(base.named_provide)
  12. base.extend(Forwardable)
  13. end
  14. def provides
  15. self.class.named_provide
  16. end
  17. end