Module: Lotu::Eventful::InstanceMethods

Defined in:
lib/lotu/behaviors/eventful.rb

Instance Method Summary collapse

Instance Method Details

#fire(event, *args) ⇒ Object



34
35
36
# File 'lib/lotu/behaviors/eventful.rb', line 34

def fire(event, *args)
  @_events[event].call(*args) if @_events[event]
end

#init_behaviorObject



25
26
27
28
# File 'lib/lotu/behaviors/eventful.rb', line 25

def init_behavior
  super
  @_events = {}
end

#on(event, &blk) ⇒ Object



30
31
32
# File 'lib/lotu/behaviors/eventful.rb', line 30

def on(event, &blk)
  @_events[event] = blk
end