Class: GorgonAMQ::Protocol::Basic::Cancel

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(consumer_tag, nowait) ⇒ Cancel

Returns a new instance of Cancel.



1658
1659
1660
1661
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1658

def initialize(consumer_tag, nowait)
  @consumer_tag = consumer_tag
  @nowait = nowait
end

Instance Attribute Details

#consumer_tagObject (readonly)

Returns the value of attribute consumer_tag.



1657
1658
1659
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1657

def consumer_tag
  @consumer_tag
end

#nowaitObject (readonly)

Returns the value of attribute nowait.



1657
1658
1659
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1657

def nowait
  @nowait
end

Class Method Details

.decode(data) ⇒ Object

Returns:



1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1645

def self.decode(data)
  offset = 0
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  consumer_tag = data[offset, length]
  offset += length
  bit_buffer = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  nowait = (bit_buffer & (1 << 0)) != 0
  self.new(consumer_tag, nowait)
end

.encode(channel, consumer_tag, nowait) ⇒ Object

u’consumer_tag = nil’, u’nowait = false’

Returns:



1669
1670
1671
1672
1673
1674
1675
1676
1677
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1669

def self.encode(channel, consumer_tag, nowait)
  buffer = @packed_indexes.dup
  buffer << consumer_tag.to_s.bytesize.chr
  buffer << consumer_tag.to_s
  bit_buffer = 0
  bit_buffer = bit_buffer | (1 << 0) if nowait
  buffer << [bit_buffer].pack(PACK_CHAR)
  MethodFrame.new(buffer, channel)
end

.has_content?Boolean

Returns:

  • (Boolean)


1663
1664
1665
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 1663

def self.has_content?
  false
end