Module: EventStream::SubscriberDSL::ClassMethods

Defined in:
lib/event_stream/subscriber_dsl.rb

Instance Method Summary collapse

Instance Method Details

#event_stream(event_stream) ⇒ Object



36
37
38
# File 'lib/event_stream/subscriber_dsl.rb', line 36

def event_stream(event_stream)
  self._event_stream = event_stream
end

#on(filter, &action) ⇒ Object



40
41
42
# File 'lib/event_stream/subscriber_dsl.rb', line 40

def on(filter, &action)
  self._event_subscribers << Subscriber.create(filter, &action)
end

#subscribeObject



44
45
46
# File 'lib/event_stream/subscriber_dsl.rb', line 44

def subscribe
  _event_subscribers.each { |subscriber| _event_stream.add_subscriber(subscriber) }
end