Class: MessagePack::RPC::AsyncResult
- Inherits:
-
Object
- Object
- MessagePack::RPC::AsyncResult
- Defined in:
- lib/msgpack/rpc/server.rb
Instance Method Summary collapse
- #error(err) ⇒ Object
-
#initialize ⇒ AsyncResult
constructor
A new instance of AsyncResult.
- #result(retval, err = nil) ⇒ Object
-
#set_responder(res) ⇒ Object
:nodoc:.
Constructor Details
#initialize ⇒ AsyncResult
Returns a new instance of AsyncResult.
128 129 130 131 |
# File 'lib/msgpack/rpc/server.rb', line 128 def initialize @responder = nil @sent = false end |
Instance Method Details
#error(err) ⇒ Object
145 146 147 148 |
# File 'lib/msgpack/rpc/server.rb', line 145 def error(err) result(nil, err) nil end |
#result(retval, err = nil) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/msgpack/rpc/server.rb', line 133 def result(retval, err = nil) unless @sent if @responder @responder.result(retval, err) else @result = [retval, err] end @sent = true end nil end |
#set_responder(res) ⇒ Object
:nodoc:
150 151 152 153 154 155 156 |
# File 'lib/msgpack/rpc/server.rb', line 150 def set_responder(res) #:nodoc: @responder = res if @sent && @result @responder.result(*@result) @result = nil end end |