Class: GorgonAMQ::Protocol::Basic::Return

Inherits:
Method
  • Object
show all
Defined in:
lib/gorgon_amq-protocol/lib/gorgon_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(reply_code, reply_text, exchange, routing_key) ⇒ Return

Returns a new instance of Return.



1774
1775
1776
1777
1778
1779
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1774

def initialize(reply_code, reply_text, exchange, routing_key)
  @reply_code = reply_code
  @reply_text = reply_text
  @exchange = exchange
  @routing_key = routing_key
end

Instance Attribute Details

#exchangeObject (readonly)

Returns the value of attribute exchange.



1773
1774
1775
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1773

def exchange
  @exchange
end

#reply_codeObject (readonly)

Returns the value of attribute reply_code.



1773
1774
1775
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1773

def reply_code
  @reply_code
end

#reply_textObject (readonly)

Returns the value of attribute reply_text.



1773
1774
1775
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1773

def reply_text
  @reply_text
end

#routing_keyObject (readonly)

Returns the value of attribute routing_key.



1773
1774
1775
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1773

def routing_key
  @routing_key
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1754

def self.decode(data)
  offset = 0
  reply_code = data[offset, 2].unpack(PACK_UINT16).first
  offset += 2
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  reply_text = data[offset, length]
  offset += length
  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
  self.new(reply_code, reply_text, exchange, routing_key)
end

.has_content?Boolean

Returns:

  • (Boolean)


1781
1782
1783
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1781

def self.has_content?
  true
end