Class: Downstream::Stateless::Subscriber
- Inherits:
-
Object
- Object
- Downstream::Stateless::Subscriber
- Defined in:
- lib/downstream/pubsub_adapters/stateless/subscriber.rb
Instance Attribute Summary collapse
-
#callable ⇒ Object
readonly
Returns the value of attribute callable.
Instance Method Summary collapse
- #call(name, event) ⇒ Object
-
#initialize(callable) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(callable) ⇒ Subscriber
Returns a new instance of Subscriber.
6 7 8 |
# File 'lib/downstream/pubsub_adapters/stateless/subscriber.rb', line 6 def initialize(callable) @callable = callable end |
Instance Attribute Details
#callable ⇒ Object (readonly)
Returns the value of attribute callable.
4 5 6 |
# File 'lib/downstream/pubsub_adapters/stateless/subscriber.rb', line 4 def callable @callable end |
Instance Method Details
#call(name, event) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/downstream/pubsub_adapters/stateless/subscriber.rb', line 10 def call(name, event) if (callable.respond_to?(:arity) && callable.arity == 2) || callable.method(:call).arity == 2 callable.call(name, event) else callable.call(event) end end |