Class: Hemi::Event::LoopMachine
- Inherits:
-
Object
- Object
- Hemi::Event::LoopMachine
- Includes:
- Singleton
- Defined in:
- lib/hemi/event/loop_machine.rb
Class Attribute Summary collapse
-
.current ⇒ Object
readonly
Returns the value of attribute current.
-
.loops ⇒ Object
readonly
Returns the value of attribute loops.
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.current ⇒ Object (readonly)
Returns the value of attribute current.
24 25 26 |
# File 'lib/hemi/event/loop_machine.rb', line 24 def current @current end |
.loops ⇒ Object (readonly)
Returns the value of attribute loops.
24 25 26 |
# File 'lib/hemi/event/loop_machine.rb', line 24 def loops @loops end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
8 9 10 |
# File 'lib/hemi/event/loop_machine.rb', line 8 def event @event end |
Class Method Details
.[](name) ⇒ Object
34 35 36 |
# File 'lib/hemi/event/loop_machine.rb', line 34 def [](name) @loops[name] end |
.register(name, logic, events) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/hemi/event/loop_machine.rb', line 26 def register(name, logic, events) event_loop = EventLoop.new(logic, events) @current = event_loop if loops.empty? @loops[name] = event_loop event_loop end |
.switch(name) ⇒ Object
38 39 40 |
# File 'lib/hemi/event/loop_machine.rb', line 38 def switch(name) @current = LoopMachine[name] end |