Class: CPEE::Callback
- Inherits:
-
Object
- Object
- CPEE::Callback
- Defined in:
- lib/cpee/callback.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
Instance Method Summary collapse
- #callback(result = nil, options = nil) ⇒ Object
- #delete_if!(event, key) ⇒ Object
-
#initialize(info, handler, method, event, key, protocol, *data) ⇒ Callback
constructor
A new instance of Callback.
Constructor Details
#initialize(info, handler, method, event, key, protocol, *data) ⇒ Callback
Returns a new instance of Callback.
18 19 20 21 22 23 24 25 26 |
# File 'lib/cpee/callback.rb', line 18 def initialize(info,handler,method,event,key,protocol,*data) @info = info @event = event @key = key @data = data @handler = handler @protocol = protocol @method = method.class == Symbol ? method : :callback end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
28 29 30 |
# File 'lib/cpee/callback.rb', line 28 def info @info end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
28 29 30 |
# File 'lib/cpee/callback.rb', line 28 def method @method end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
28 29 30 |
# File 'lib/cpee/callback.rb', line 28 def protocol @protocol end |
Instance Method Details
#callback(result = nil, options = nil) ⇒ Object
35 36 37 |
# File 'lib/cpee/callback.rb', line 35 def callback(result=nil,=nil) @handler.send @method, result, , *@data end |
#delete_if!(event, key) ⇒ Object
30 31 32 33 |
# File 'lib/cpee/callback.rb', line 30 def delete_if!(event,key) @handler.send @method, :DELETE, nil, *@data if @key == key && @event == event nil end |