Class: GorgonAMQ::Protocol::Connection::Blocked

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(reason) ⇒ Blocked

Returns a new instance of Blocked.



530
531
532
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 530

def initialize(reason)
  @reason = reason
end

Instance Attribute Details

#reasonObject (readonly)

Returns the value of attribute reason.



529
530
531
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 529

def reason
  @reason
end

Class Method Details

.decode(data) ⇒ Object

Returns:



520
521
522
523
524
525
526
527
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 520

def self.decode(data)
  offset = 0
  length = data[offset, 1].unpack(PACK_CHAR).first
  offset += 1
  reason = data[offset, length]
  offset += length
  self.new(reason)
end

.encode(reason) ⇒ Object

u’reason = EMPTY_STRING’

Returns:



540
541
542
543
544
545
546
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 540

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

.has_content?Boolean

Returns:

  • (Boolean)


534
535
536
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/protocol/client.rb', line 534

def self.has_content?
  false
end