Class: Fare::SubscriberStack

Inherits:
Object
  • Object
show all
Defined in:
lib/fare/subscriber_stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configurationObject (readonly)

Returns the value of attribute configuration.



4
5
6
# File 'lib/fare/subscriber_stack.rb', line 4

def configuration
  @configuration
end

#runObject (readonly)

Returns the value of attribute run.



4
5
6
# File 'lib/fare/subscriber_stack.rb', line 4

def run
  @run
end

#stackObject (readonly)

Returns the value of attribute stack.



4
5
6
# File 'lib/fare/subscriber_stack.rb', line 4

def stack
  @stack
end

#topicsObject (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

Returns:

  • (Boolean)


17
18
19
# File 'lib/fare/subscriber_stack.rb', line 17

def handles?(event)
  topics.any? { |topic| topic.handles?(event) }
end

#to_appObject



13
14
15
# File 'lib/fare/subscriber_stack.rb', line 13

def to_app
  @app ||= build_stack
end