Class: PubsubNotifier::Broadcasters::Base
- Inherits:
-
Object
- Object
- PubsubNotifier::Broadcasters::Base
- Defined in:
- lib/pubsub_notifier/broadcasters.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #broadcast(subscriber, publisher, event, *args) ⇒ Object
- #configure(opts = {}) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
6 7 8 |
# File 'lib/pubsub_notifier/broadcasters.rb', line 6 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/pubsub_notifier/broadcasters.rb', line 4 def @options end |
Instance Method Details
#broadcast(subscriber, publisher, event, *args) ⇒ Object
16 17 18 |
# File 'lib/pubsub_notifier/broadcasters.rb', line 16 def broadcast(subscriber, publisher, event, *args) raise NotImplementedError end |
#configure(opts = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/pubsub_notifier/broadcasters.rb', line 10 def configure(opts = {}) self. = .merge(opts).reject { |_, v| v.nil? }.each_with_object({}) do |(key, proc_or_value), result| result[key] = proc_or_value.is_a?(Proc) ? proc_or_value.call : proc_or_value end end |