Class: AMQ::Protocol::Basic::GetOk

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, redelivered, exchange, routing_key, message_count) ⇒ GetOk

Returns a new instance of GetOk.



1935
1936
1937
1938
1939
1940
1941
# File 'lib/amq/protocol/client.rb', line 1935

def initialize(delivery_tag, redelivered, exchange, routing_key, message_count)
  @delivery_tag = delivery_tag
  @redelivered = redelivered
  @exchange = exchange
  @routing_key = routing_key
  @message_count = message_count
end

Instance Attribute Details

#delivery_tagObject (readonly)

Returns the value of attribute delivery_tag.



1934
1935
1936
# File 'lib/amq/protocol/client.rb', line 1934

def delivery_tag
  @delivery_tag
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



1934
1935
1936
# File 'lib/amq/protocol/client.rb', line 1934

def exchange
  @exchange
end

#message_countObject (readonly)

Returns the value of attribute message_count.



1934
1935
1936
# File 'lib/amq/protocol/client.rb', line 1934

def message_count
  @message_count
end

#redeliveredObject (readonly)

Returns the value of attribute redelivered.



1934
1935
1936
# File 'lib/amq/protocol/client.rb', line 1934

def redelivered
  @redelivered
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



1934
1935
1936
# File 'lib/amq/protocol/client.rb', line 1934

def routing_key
  @routing_key
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
# File 'lib/amq/protocol/client.rb', line 1914

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
  redelivered = (bit_buffer & (1 << 0)) != 0
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  exchange = data[offset, length]
  offset += length
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  routing_key = data[offset, length]
  offset += length
  message_count = data[offset, 4].unpack(PACK_UINT32).first
  offset += 4
  self.new(delivery_tag, redelivered, exchange, routing_key, message_count)
end

.has_content?Boolean

Returns:

  • (Boolean)


1943
1944
1945
# File 'lib/amq/protocol/client.rb', line 1943

def self.has_content?
  true
end