Class: Hook
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
Instance Method Summary collapse
- #connected(&block) ⇒ Object
-
#initialize ⇒ Hook
constructor
A new instance of Hook.
- #message(request, &block) ⇒ Object
Constructor Details
#initialize ⇒ Hook
Returns a new instance of Hook.
12 13 14 15 16 17 |
# File 'lib/cocaine/testing/mock_server.rb', line 12 def initialize @callbacks = { :connected => lambda {}, :message => {} } end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
11 12 13 |
# File 'lib/cocaine/testing/mock_server.rb', line 11 def callbacks @callbacks end |
Instance Method Details
#connected(&block) ⇒ Object
19 20 21 |
# File 'lib/cocaine/testing/mock_server.rb', line 19 def connected(&block) @callbacks[:connected] = block end |
#message(request, &block) ⇒ Object
23 24 25 |
# File 'lib/cocaine/testing/mock_server.rb', line 23 def (request, &block) @callbacks[:message][request] = block end |