Class: Typed::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/typed/events.rb

Instance Method Summary collapse

Constructor Details

#initializeEvents

Returns a new instance of Events.



3
4
5
# File 'lib/typed/events.rb', line 3

def initialize
  @callbacks = {}
end

Instance Method Details

#fire(type, key, val) ⇒ Object



11
12
13
# File 'lib/typed/events.rb', line 11

def fire(type, key, val)
  event(type).each{|block| block.call(key,val)}
end

#on(type, &block) ⇒ Object



7
8
9
# File 'lib/typed/events.rb', line 7

def on(type, &block)
  event(type) << block
end