Module: Specdown::EventServer

Extended by:
EventServer
Included in:
EventServer
Defined in:
lib/specdown/event_server.rb

Instance Method Summary collapse

Instance Method Details

#event(event_name, *args) ⇒ Object



5
6
7
# File 'lib/specdown/event_server.rb', line 5

def event(event_name, *args)
  callbacks[event_name].map {|callback| callback.call *args} if callbacks[event_name] 
end

#register(event_name, &callback) ⇒ Object



9
10
11
12
# File 'lib/specdown/event_server.rb', line 9

def register(event_name, &callback)
  callbacks[event_name] ||= []
  callbacks[event_name] << callback
end