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.



1962
1963
1964
1965
1966
1967
1968
# File 'lib/amq/protocol/client.rb', line 1962

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.



1961
1962
1963
# File 'lib/amq/protocol/client.rb', line 1961

def delivery_tag
  @delivery_tag
end

#exchangeObject (readonly)

Returns the value of attribute exchange.



1961
1962
1963
# File 'lib/amq/protocol/client.rb', line 1961

def exchange
  @exchange
end

#message_countObject (readonly)

Returns the value of attribute message_count.



1961
1962
1963
# File 'lib/amq/protocol/client.rb', line 1961

def message_count
  @message_count
end

#redeliveredObject (readonly)

Returns the value of attribute redelivered.



1961
1962
1963
# File 'lib/amq/protocol/client.rb', line 1961

def redelivered
  @redelivered
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



1961
1962
1963
# File 'lib/amq/protocol/client.rb', line 1961

def routing_key
  @routing_key
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
# File 'lib/amq/protocol/client.rb', line 1941

def self.decode(data)
  offset = offset = 0 # self-assigning offset to eliminate "assigned but unused variable" warning even if offset is not used in this method
  delivery_tag = AMQ::Pack.unpack_uint64_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)


1970
1971
1972
# File 'lib/amq/protocol/client.rb', line 1970

def self.has_content?
  true
end