Module: Lotu::Eventful
- Defined in:
- lib/lotu/behaviors/eventful.rb
Instance Method Summary collapse
Instance Method Details
#fire(event, *args) ⇒ Object
30 31 32 |
# File 'lib/lotu/behaviors/eventful.rb', line 30 def fire(event, *args) @events[event].call(*args) if @events[event] end |
#init_behavior(opts) ⇒ Object
21 22 23 24 |
# File 'lib/lotu/behaviors/eventful.rb', line 21 def init_behavior opts super if defined? super @events = {} end |
#on(event, &blk) ⇒ Object
26 27 28 |
# File 'lib/lotu/behaviors/eventful.rb', line 26 def on(event, &blk) @events[event] = blk end |