Class: AMQ::Protocol::Basic::CreditDrained
- Defined in:
- lib/amq/protocol/client.rb
Instance Attribute Summary collapse
-
#consumer_tag ⇒ Object
readonly
Returns the value of attribute consumer_tag.
-
#credit_drained ⇒ Object
readonly
Returns the value of attribute credit_drained.
Class Method Summary collapse
- .decode(data) ⇒ Object
-
.encode(channel, consumer_tag, credit_drained) ⇒ Object
[u’consumer_tag = EMPTY_STRING’, u’credit_drained = nil’].
- .has_content? ⇒ Boolean
Instance Method Summary collapse
-
#initialize(consumer_tag, credit_drained) ⇒ CreditDrained
constructor
A new instance of CreditDrained.
Methods inherited from Method
encode_body, index, inherited, instantiate, method_id, methods, name, split_headers
Constructor Details
#initialize(consumer_tag, credit_drained) ⇒ CreditDrained
Returns a new instance of CreditDrained.
2269 2270 2271 2272 |
# File 'lib/amq/protocol/client.rb', line 2269 def initialize(consumer_tag, credit_drained) @consumer_tag = consumer_tag @credit_drained = credit_drained end |
Instance Attribute Details
#consumer_tag ⇒ Object (readonly)
Returns the value of attribute consumer_tag.
2268 2269 2270 |
# File 'lib/amq/protocol/client.rb', line 2268 def consumer_tag @consumer_tag end |
#credit_drained ⇒ Object (readonly)
Returns the value of attribute credit_drained.
2268 2269 2270 |
# File 'lib/amq/protocol/client.rb', line 2268 def credit_drained @credit_drained end |
Class Method Details
.decode(data) ⇒ Object
2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 |
# File 'lib/amq/protocol/client.rb', line 2257 def self.decode(data) offset = 0 length = data[offset, 1].unpack(PACK_CHAR).first offset += 1 consumer_tag = data[offset, length] offset += length credit_drained = data[offset, 4].unpack(PACK_UINT32).first offset += 4 self.new(consumer_tag, credit_drained) end |
.encode(channel, consumer_tag, credit_drained) ⇒ Object
- u’consumer_tag = EMPTY_STRING’, u’credit_drained = nil’
2280 2281 2282 2283 2284 2285 2286 2287 |
# File 'lib/amq/protocol/client.rb', line 2280 def self.encode(channel, consumer_tag, credit_drained) buffer = '' buffer << @packed_indexes buffer << consumer_tag.to_s.bytesize.chr buffer << consumer_tag.to_s buffer << [credit_drained].pack(PACK_UINT32) MethodFrame.new(buffer, channel) end |
.has_content? ⇒ Boolean
2274 2275 2276 |
# File 'lib/amq/protocol/client.rb', line 2274 def self.has_content? false end |