Module: ActivePubsubRails::Subscriber
- Defined in:
- lib/active_pubsub_rails/subscriber.rb
Class Method Summary collapse
Instance Method Summary collapse
- #activate ⇒ Object
- #deactivate(event_action_name = nil) ⇒ Object
- #event_action(method_name, event_name: nil) ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/active_pubsub_rails/subscriber.rb', line 5 def self.included(base) base.extend base base.mattr_accessor :event_actions base.event_actions = {} ActivePubsubRails.subscriber_registry.register(base) end |
Instance Method Details
#activate ⇒ Object
18 19 20 |
# File 'lib/active_pubsub_rails/subscriber.rb', line 18 def activate ActivePubsubRails.subscriber_registry.activate_subscriber(self) end |
#deactivate(event_action_name = nil) ⇒ Object
22 23 24 |
# File 'lib/active_pubsub_rails/subscriber.rb', line 22 def deactivate(event_action_name = nil) ActivePubsubRails.subscriber_registry.deactivate_subscriber(self, event_action_name) end |
#event_action(method_name, event_name: nil) ⇒ Object
14 15 16 |
# File 'lib/active_pubsub_rails/subscriber.rb', line 14 def event_action(method_name, event_name: nil) event_actions[method_name] = (event_name || method_name).to_s end |