Class: MicroBunny::EventTrigger
- Inherits:
-
Object
- Object
- MicroBunny::EventTrigger
- Defined in:
- lib/microbunny/event_trigger.rb
Instance Method Summary collapse
- #broadcast ⇒ Object
- #for(record) ⇒ Object
-
#initialize(channel, name, lookup = EventLookup) ⇒ EventTrigger
constructor
A new instance of EventTrigger.
- #with(payload) ⇒ Object
Constructor Details
#initialize(channel, name, lookup = EventLookup) ⇒ EventTrigger
Returns a new instance of EventTrigger.
3 4 5 |
# File 'lib/microbunny/event_trigger.rb', line 3 def initialize(channel, name, lookup = EventLookup) @event = lookup.new(name).event.new(channel) end |
Instance Method Details
#broadcast ⇒ Object
17 18 19 |
# File 'lib/microbunny/event_trigger.rb', line 17 def broadcast record ? @event.trigger(payload, record) : @event.trigger(payload) end |
#for(record) ⇒ Object
12 13 14 15 |
# File 'lib/microbunny/event_trigger.rb', line 12 def for(record) @record = record self end |
#with(payload) ⇒ Object
7 8 9 10 |
# File 'lib/microbunny/event_trigger.rb', line 7 def with(payload) @payload = payload self end |