Class: GorgonAMQ::Protocol::FrameSubclass
- Defined in:
- lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb
Direct Known Subclasses
Constant Summary
Constants inherited from Frame
GorgonAMQ::Protocol::Frame::CHANNEL_RANGE, GorgonAMQ::Protocol::Frame::CLASSES, GorgonAMQ::Protocol::Frame::FINAL_OCTET, GorgonAMQ::Protocol::Frame::TYPES, GorgonAMQ::Protocol::Frame::TYPES_OPTIONS, GorgonAMQ::Protocol::Frame::TYPES_REVERSE
Instance Attribute Summary collapse
-
#channel ⇒ Object
Returns the value of attribute channel.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Class Method Summary collapse
Instance Method Summary collapse
- #encode ⇒ Object
-
#encode_to_array ⇒ Object
private
TODO: remove once we are sure none of the clients uses this method directly.
-
#initialize(payload, channel) ⇒ FrameSubclass
constructor
A new instance of FrameSubclass.
- #size ⇒ Object
Methods inherited from Frame
#__new__, decode, decode_header, encode_to_array, encoded_payload, #final?, find_type
Constructor Details
#initialize(payload, channel) ⇒ FrameSubclass
Returns a new instance of FrameSubclass.
90 91 92 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 90 def initialize(payload, channel) @payload, @channel = payload, channel end |
Instance Attribute Details
#channel ⇒ Object
Returns the value of attribute channel.
88 89 90 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 88 def channel @channel end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
89 90 91 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 89 def payload @payload end |
Class Method Details
.encode(payload, channel) ⇒ Object
84 85 86 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 84 def self.encode(payload, channel) super(@id, payload, channel) end |
.id ⇒ Object
80 81 82 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 80 def self.id @id end |
Instance Method Details
#encode ⇒ Object
109 110 111 112 113 114 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 109 def encode s = [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32) s << self.class.encoded_payload(@payload) s << FINAL_OCTET s end |
#encode_to_array ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: remove once we are sure none of the clients
uses this method directly
101 102 103 104 105 106 107 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 101 def encode_to_array components = [] components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32) components << self.class.encoded_payload(@payload) components << FINAL_OCTET components end |
#size ⇒ Object
94 95 96 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/frame.rb', line 94 def size @payload.bytesize end |