Class: AMQ::Protocol::Basic::Ack

Inherits:
Method
  • Object
show all
Defined in:
lib/amq/protocol/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Method

encode_body, index, inherited, instantiate, method_id, methods, name, split_headers

Constructor Details

#initialize(delivery_tag, multiple) ⇒ Ack

Returns a new instance of Ack.



1874
1875
1876
1877
# File 'lib/amq/protocol/client.rb', line 1874

def initialize(delivery_tag, multiple)
  @delivery_tag = delivery_tag
  @multiple = multiple
end

Instance Attribute Details

#delivery_tagObject (readonly)

Returns the value of attribute delivery_tag.



1873
1874
1875
# File 'lib/amq/protocol/client.rb', line 1873

def delivery_tag
  @delivery_tag
end

#multipleObject (readonly)

Returns the value of attribute multiple.



1873
1874
1875
# File 'lib/amq/protocol/client.rb', line 1873

def multiple
  @multiple
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1863
1864
1865
1866
1867
1868
1869
1870
1871
# File 'lib/amq/protocol/client.rb', line 1863

def self.decode(data)
  offset = 0
  delivery_tag = AMQ::Hacks.unpack_64_big_endian(data[offset, 8]).first
  offset += 8
  bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  multiple = (bit_buffer & (1 << 0)) != 0
  self.new(delivery_tag, multiple)
end

.encode(channel, delivery_tag, multiple) ⇒ Object

“delivery_tag = false”, “multiple = false”

Returns:



1885
1886
1887
1888
1889
1890
1891
1892
1893
# File 'lib/amq/protocol/client.rb', line 1885

def self.encode(channel, delivery_tag, multiple)
  buffer = ""
  buffer << @packed_indexes
  buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
  bit_buffer = 0
  bit_buffer = bit_buffer | (1 << 0) if multiple
  buffer << [bit_buffer].pack(PACK_CHAR)
  MethodFrame.new(buffer, channel)
end

.has_content?Boolean

Returns:

  • (Boolean)


1879
1880
1881
# File 'lib/amq/protocol/client.rb', line 1879

def self.has_content?
  false
end