Class: Hecks::Adapters::Events
- Inherits:
-
Object
- Object
- Hecks::Adapters::Events
- Defined in:
- lib/events/events.rb
Instance Method Summary collapse
-
#initialize(listeners: []) ⇒ Events
constructor
A new instance of Events.
- #send(module_name:, command:) ⇒ Object
Constructor Details
#initialize(listeners: []) ⇒ Events
5 6 7 |
# File 'lib/events/events.rb', line 5 def initialize(listeners: []) @listeners = listeners end |
Instance Method Details
#send(module_name:, command:) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/events/events.rb', line 9 def send(module_name:, command:) @command = command @module_name = module_name listeners.each do |listener| next unless listener.respond_to?(event_name) listener.public_send(event_name, command) end end |