Class: HookManager
Instance Method Summary collapse
- #call(type, *args) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ HookManager
constructor
A new instance of HookManager.
- #on(type, &block) ⇒ Object
Constructor Details
#initialize ⇒ HookManager
Returns a new instance of HookManager.
14 15 16 |
# File 'lib/cocaine/asio/connection.rb', line 14 def initialize @hooks = {} end |
Instance Method Details
#call(type, *args) ⇒ Object
26 27 28 |
# File 'lib/cocaine/asio/connection.rb', line 26 def call(type, *args) @hooks[type].call *args if @hooks.has_key? type end |
#clear ⇒ Object
22 23 24 |
# File 'lib/cocaine/asio/connection.rb', line 22 def clear @hooks.clear end |
#on(type, &block) ⇒ Object
18 19 20 |
# File 'lib/cocaine/asio/connection.rb', line 18 def on(type, &block) @hooks[type] = block end |