Class: AMQ::Protocol::Connection::Close
- Defined in:
- lib/amq/protocol/client.rb
Instance Attribute Summary collapse
-
#class_id ⇒ Object
readonly
Returns the value of attribute class_id.
-
#method_id ⇒ Object
readonly
Returns the value of attribute method_id.
-
#reply_code ⇒ Object
readonly
Returns the value of attribute reply_code.
-
#reply_text ⇒ Object
readonly
Returns the value of attribute reply_text.
Class Method Summary collapse
- .decode(data) ⇒ Object
-
.encode(reply_code, reply_text, class_id, method_id) ⇒ Object
[u’reply_code = nil’, u’reply_text = EMPTY_STRING’, u’class_id = nil’, u’method_id = nil’].
- .has_content? ⇒ Boolean
Instance Method Summary collapse
-
#initialize(reply_code, reply_text, class_id, method_id) ⇒ Close
constructor
A new instance of Close.
Methods inherited from Method
encode_body, index, inherited, instantiate, method_id, methods, name, split_headers
Constructor Details
#initialize(reply_code, reply_text, class_id, method_id) ⇒ Close
Returns a new instance of Close.
550 551 552 553 554 555 |
# File 'lib/amq/protocol/client.rb', line 550 def initialize(reply_code, reply_text, class_id, method_id) @reply_code = reply_code @reply_text = reply_text @class_id = class_id @method_id = method_id end |
Instance Attribute Details
#class_id ⇒ Object (readonly)
Returns the value of attribute class_id.
549 550 551 |
# File 'lib/amq/protocol/client.rb', line 549 def class_id @class_id end |
#method_id ⇒ Object (readonly)
Returns the value of attribute method_id.
549 550 551 |
# File 'lib/amq/protocol/client.rb', line 549 def method_id @method_id end |
#reply_code ⇒ Object (readonly)
Returns the value of attribute reply_code.
549 550 551 |
# File 'lib/amq/protocol/client.rb', line 549 def reply_code @reply_code end |
#reply_text ⇒ Object (readonly)
Returns the value of attribute reply_text.
549 550 551 |
# File 'lib/amq/protocol/client.rb', line 549 def reply_text @reply_text end |
Class Method Details
.decode(data) ⇒ Object
534 535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/amq/protocol/client.rb', line 534 def self.decode(data) offset = 0 reply_code = data[offset, 2].unpack(PACK_UINT16).first offset += 2 length = data[offset, 1].unpack(PACK_CHAR).first offset += 1 reply_text = data[offset, length] offset += length class_id = data[offset, 2].unpack(PACK_UINT16).first offset += 2 method_id = data[offset, 2].unpack(PACK_UINT16).first offset += 2 self.new(reply_code, reply_text, class_id, method_id) end |
.encode(reply_code, reply_text, class_id, method_id) ⇒ Object
- u’reply_code = nil’, u’reply_text = EMPTY_STRING’, u’class_id = nil’, u’method_id = nil’
563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/amq/protocol/client.rb', line 563 def self.encode(reply_code, reply_text, class_id, method_id) channel = 0 buffer = '' buffer << @packed_indexes buffer << [reply_code].pack(PACK_UINT16) buffer << reply_text.to_s.bytesize.chr buffer << reply_text.to_s buffer << [class_id].pack(PACK_UINT16) buffer << [method_id].pack(PACK_UINT16) MethodFrame.new(buffer, channel) end |
.has_content? ⇒ Boolean
557 558 559 |
# File 'lib/amq/protocol/client.rb', line 557 def self.has_content? false end |