abstract class Pulsar::Event
- Pulsar::Event
- Reference
- Object
Defined in:
pulsar/event.crClass Method Summary
-
.subscribe(&block : self -> Nil)
Subscribe to events
Instance Method Summary
-
#name
Returns the name of the event.
-
#publish
Publishes the event to all subscribers.
-
#started_at
When the event started
Class Method Detail
def self.subscribe(&block : self -> Nil)
#
Subscribe to events
MyEvent.subscribe do |event|
puts event.name # "MyEvent"
end
MyEvent.new.publish # Will run the block above
Instance Method Detail
def name
#
Returns the name of the event.
The event name is the name of the class. So an class of MyShard::MyEvent
would
return "MyShard::MyEvent"
.