Class: Onfire::Event
- Inherits:
-
Object
- Object
- Onfire::Event
- Includes:
- ProcessingMethods
- Defined in:
- lib/onfire/event.rb,
lib/onfire/debugging.rb
Overview
An event carries a type, source, and optional payload. Calling #bubble! it starts at its source and traverses up the hierarchy using #parent. On every node it calls #handlers_for_event on the node while calling returned procs.
Defined Under Namespace
Modules: Debugging, ProcessingMethods
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#source ⇒ Object
Returns the value of attribute source.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, source, data = nil) ⇒ Event
constructor
A new instance of Event.
-
#stop! ⇒ Object
Stop event bubbling.
- #stopped? ⇒ Boolean
Methods included from ProcessingMethods
#bubble!, #call_handler, #process_node
Constructor Details
#initialize(type, source, data = nil) ⇒ Event
Returns a new instance of Event.
9 10 11 12 13 |
# File 'lib/onfire/event.rb', line 9 def initialize(type, source, data=nil) @type = type @source = source @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
7 8 9 |
# File 'lib/onfire/event.rb', line 7 def data @data end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/onfire/event.rb', line 7 def source @source end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/onfire/event.rb', line 7 def type @type end |
Instance Method Details
#stop! ⇒ Object
Stop event bubbling.
20 21 22 |
# File 'lib/onfire/event.rb', line 20 def stop! @stopped = true end |
#stopped? ⇒ Boolean
15 16 17 |
# File 'lib/onfire/event.rb', line 15 def stopped? @stopped ||= false end |