Class: Wamp::Client::Response::CallResult
- Inherits:
-
Object
- Object
- Wamp::Client::Response::CallResult
- Defined in:
- lib/wamp/client/response.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
Class Method Summary collapse
- .ensure(result, allow_error: false, allow_defer: false) ⇒ Object
- .from_hash(hash) ⇒ Object
- .from_yield_message(msg) ⇒ Object
Instance Method Summary collapse
-
#initialize(args = nil, kwargs = nil) ⇒ CallResult
constructor
A new instance of CallResult.
- #to_hash ⇒ Object
Constructor Details
#initialize(args = nil, kwargs = nil) ⇒ CallResult
Returns a new instance of CallResult.
51 52 53 54 |
# File 'lib/wamp/client/response.rb', line 51 def initialize(args=nil, kwargs=nil) @args = args || [] @kwargs = kwargs || {} end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
49 50 51 |
# File 'lib/wamp/client/response.rb', line 49 def args @args end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs.
49 50 51 |
# File 'lib/wamp/client/response.rb', line 49 def kwargs @kwargs end |
Class Method Details
.ensure(result, allow_error: false, allow_defer: false) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/wamp/client/response.rb', line 68 def self.ensure(result, allow_error: false, allow_defer: false) unless result.is_a?(self) or (allow_error and result.is_a?(CallError)) or (allow_defer and result.is_a?(CallDefer)) result = result != nil ? self.new([result]) : self.new end result end |
.from_hash(hash) ⇒ Object
56 57 58 |
# File 'lib/wamp/client/response.rb', line 56 def self.from_hash(hash) self.new(hash[:args], hash[:kwargs]) end |
.from_yield_message(msg) ⇒ Object
64 65 66 |
# File 'lib/wamp/client/response.rb', line 64 def self.(msg) self.new(msg.yield_arguments, msg.yield_argumentskw) end |
Instance Method Details
#to_hash ⇒ Object
60 61 62 |
# File 'lib/wamp/client/response.rb', line 60 def to_hash { args: self.args, kwargs: self.kwargs } end |