Class: Wamp::Client::Response::CallResult

Inherits:
Object
  • Object
show all
Defined in:
lib/wamp/client/response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



49
50
51
# File 'lib/wamp/client/response.rb', line 49

def args
  @args
end

#kwargsObject (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.from_yield_message(msg)
  self.new(msg.yield_arguments, msg.yield_argumentskw)
end

Instance Method Details

#to_hashObject



60
61
62
# File 'lib/wamp/client/response.rb', line 60

def to_hash
  { args: self.args, kwargs: self.kwargs }
end