Class: Wamp::Client::Message::Publish
- Defined in:
- lib/wamp/client/message.rb
Overview
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#argumentskw ⇒ Object
Returns the value of attribute argumentskw.
-
#options ⇒ Object
Returns the value of attribute options.
-
#request ⇒ Object
Returns the value of attribute request.
-
#topic ⇒ Object
Returns the value of attribute topic.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(request, options, topic, arguments = nil, argumentskw = nil) ⇒ Publish
constructor
A new instance of Publish.
- #payload ⇒ Object
- #to_s ⇒ Object
Methods included from Check
Constructor Details
#initialize(request, options, topic, arguments = nil, argumentskw = nil) ⇒ Publish
Returns a new instance of Publish.
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/wamp/client/message.rb', line 308 def initialize(request, , topic, arguments=nil, argumentskw=nil) self.class.check_id('request', request) self.class.check_dict('options', ) self.class.check_uri('topic', topic) self.class.check_list('arguments', arguments, true) self.class.check_dict('argumentskw', argumentskw, true) self.request = request self. = self.topic = topic self.arguments = arguments self.argumentskw = argumentskw end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
306 307 308 |
# File 'lib/wamp/client/message.rb', line 306 def arguments @arguments end |
#argumentskw ⇒ Object
Returns the value of attribute argumentskw.
306 307 308 |
# File 'lib/wamp/client/message.rb', line 306 def argumentskw @argumentskw end |
#options ⇒ Object
Returns the value of attribute options.
306 307 308 |
# File 'lib/wamp/client/message.rb', line 306 def @options end |
#request ⇒ Object
Returns the value of attribute request.
306 307 308 |
# File 'lib/wamp/client/message.rb', line 306 def request @request end |
#topic ⇒ Object
Returns the value of attribute topic.
306 307 308 |
# File 'lib/wamp/client/message.rb', line 306 def topic @topic end |
Class Method Details
.parse(params) ⇒ Object
328 329 330 331 332 333 334 335 336 |
# File 'lib/wamp/client/message.rb', line 328 def self.parse(params) self.check_gte('params list', 4, params.count) self.check_equal('message type', self.type, params[0]) params.shift self.new(*params) end |
Instance Method Details
#payload ⇒ Object
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/wamp/client/message.rb', line 338 def payload self.arguments ||= [] self.argumentskw ||= {} payload = [self.class.type] payload.push(self.request) payload.push(self.) payload.push(self.topic) return payload if (self.arguments.empty? and self.argumentskw.empty?) payload.push(self.arguments) return payload if (self.argumentskw.empty?) payload.push(self.argumentskw) payload end |
#to_s ⇒ Object
356 357 358 |
# File 'lib/wamp/client/message.rb', line 356 def to_s 'PUBLISH > ' + self.payload.to_s end |