Class: Fare::SubscriberStack
- Inherits:
-
Object
- Object
- Fare::SubscriberStack
- Defined in:
- lib/fare/subscriber_stack.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#run ⇒ Object
readonly
Returns the value of attribute run.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
-
#topics ⇒ Object
readonly
Returns the value of attribute topics.
Instance Method Summary collapse
- #handles?(event) ⇒ Boolean
-
#initialize(configuration, topics, run) ⇒ SubscriberStack
constructor
A new instance of SubscriberStack.
- #to_app ⇒ Object
Constructor Details
#initialize(configuration, topics, run) ⇒ SubscriberStack
Returns a new instance of SubscriberStack.
6 7 8 9 10 11 |
# File 'lib/fare/subscriber_stack.rb', line 6 def initialize(configuration, topics, run) @configuration = configuration @topics = topics @run = run @stack = [] end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/fare/subscriber_stack.rb', line 4 def configuration @configuration end |
#run ⇒ Object (readonly)
Returns the value of attribute run.
4 5 6 |
# File 'lib/fare/subscriber_stack.rb', line 4 def run @run end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
4 5 6 |
# File 'lib/fare/subscriber_stack.rb', line 4 def stack @stack end |
#topics ⇒ Object (readonly)
Returns the value of attribute topics.
4 5 6 |
# File 'lib/fare/subscriber_stack.rb', line 4 def topics @topics end |
Instance Method Details
#handles?(event) ⇒ Boolean
17 18 19 |
# File 'lib/fare/subscriber_stack.rb', line 17 def handles?(event) topics.any? { |topic| topic.handles?(event) } end |
#to_app ⇒ Object
13 14 15 |
# File 'lib/fare/subscriber_stack.rb', line 13 def to_app @app ||= build_stack end |