Class: AMQ::Protocol::Connection::UpdateSecret

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(new_secret, reason) ⇒ UpdateSecret

Returns a new instance of UpdateSecret.



600
601
602
603
# File 'lib/amq/protocol/client.rb', line 600

def initialize(new_secret, reason)
  @new_secret = new_secret
  @reason = reason
end

Instance Attribute Details

#new_secretObject (readonly)

Returns the value of attribute new_secret.



599
600
601
# File 'lib/amq/protocol/client.rb', line 599

def new_secret
  @new_secret
end

#reasonObject (readonly)

Returns the value of attribute reason.



599
600
601
# File 'lib/amq/protocol/client.rb', line 599

def reason
  @reason
end

Class Method Details

.decode(data) ⇒ Object

Returns:



586
587
588
589
590
591
592
593
594
595
596
597
# File 'lib/amq/protocol/client.rb', line 586

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
  length = data[offset, 4].unpack(PACK_UINT32).first
  offset += 4
  new_secret = data[offset, length]
  offset += length
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  reason = data[offset, length]
  offset += length
  self.new(new_secret, reason)
end

.encode(new_secret, reason) ⇒ Object

u’new_secret = nil’, u’reason = nil’

Returns:



611
612
613
614
615
616
617
618
619
# File 'lib/amq/protocol/client.rb', line 611

def self.encode(new_secret, reason)
  channel = 0
  buffer = @packed_indexes.dup
  buffer << [new_secret.to_s.bytesize].pack(PACK_UINT32)
  buffer << new_secret.to_s
  buffer << reason.to_s.bytesize.chr
  buffer << reason.to_s
  MethodFrame.new(buffer, channel)
end

.has_content?Boolean

Returns:

  • (Boolean)


605
606
607
# File 'lib/amq/protocol/client.rb', line 605

def self.has_content?
  false
end