Object
Future describes result of remote procedure call that is initially not known, because it is not yet received. You can wait and get the result with get method.
Attaches a callback method that is called when the result of remote method is received.
# File lib/msgpack/rpc/future.rb, line 76 76: def attach_callback(proc = nil, &block) 77: @callback_handler = proc || block 78: end
Wait for receiving result of remote procedure call and returns its result. If the remote method raises error, then this method raises RemoteError. If the remote procedure call failed with timeout, this method raises TimeoutError. Otherwise this method returns the result of remote method.
# File lib/msgpack/rpc/future.rb, line 43 43: def get 44: join 45: if error.nil? 46: if @result_handler 47: return @result_handler.call(@result) 48: else 49: return @result 50: end 51: end 52: if @result.nil? 53: # compatible error 54: raise RuntimeError.new(@error) 55: end 56: if @error_handler 57: @error_handler.call(@error, @result) 58: end 59: raise RPCError.create(@error, @result) 60: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.