Class: Wamp::Client::Message::Abort

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

Overview

Abort Sent by a Peer*to abort the opening of a WAMP session. No response is expected. Formats:

[ABORT, Details|dict, Reason|uri]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Check

included

Constructor Details

#initialize(details, reason) ⇒ Abort

Returns a new instance of Abort.



148
149
150
151
152
153
154
155
156
# File 'lib/wamp/client/message.rb', line 148

def initialize(details, reason)

  self.class.check_dict('details', details)
  self.class.check_uri('reason', reason)

  self.details = details
  self.reason = reason

end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



146
147
148
# File 'lib/wamp/client/message.rb', line 146

def details
  @details
end

#reasonObject

Returns the value of attribute reason.



146
147
148
# File 'lib/wamp/client/message.rb', line 146

def reason
  @reason
end

Class Method Details

.parse(params) ⇒ Object



162
163
164
165
166
167
168
169
170
# File 'lib/wamp/client/message.rb', line 162

def self.parse(params)

  self.check_gte('params list', 3, params.count)
  self.check_equal('message type', self.type, params[0])

  params.shift
  self.new(*params)

end

.typeObject



158
159
160
# File 'lib/wamp/client/message.rb', line 158

def self.type
  Types::ABORT
end

Instance Method Details

#payloadObject



172
173
174
175
176
177
178
179
# File 'lib/wamp/client/message.rb', line 172

def payload

  payload = [self.class.type]
  payload.push(self.details)
  payload.push(self.reason)

  payload
end

#to_sObject



181
182
183
# File 'lib/wamp/client/message.rb', line 181

def to_s
  'ABORT > ' + self.payload.to_s
end