Parent

Class/Module Index [+]

Quicksearch

AMQ::Protocol::Method

Public Class Methods

encode_body(body, channel, frame_size) click to toggle source
# File lib/amq/protocol/client.rb, line 248
def self.encode_body(body, channel, frame_size)
  return [] if body.empty?

  # See https://dev.rabbitmq.com/wiki/Amqp091Errata#section_11
  limit        = frame_size - 8

  array = Array.new
  while body
    payload, body = body[0, limit], body[limit, body.length - limit]
    # array << [0x03, payload]
    array << BodyFrame.new(payload, channel)
  end

  array
end
index() click to toggle source
# File lib/amq/protocol/client.rb, line 220
def self.index
  @index
end
inherited(base) click to toggle source
# File lib/amq/protocol/client.rb, line 224
def self.inherited(base)
  if self == Protocol::Method
    @methods << base
  end
end
instantiate(*args, &block) click to toggle source

We can return different:

  • instantiate given subclass of Method

  • create an OpenStruct object

  • create a hash

  • yield params into the block rather than just return

@api plugin

# File lib/amq/protocol/client.rb, line 270
def self.instantiate(*args, &block)
  self.new(*args, &block)
  # or OpenStruct.new(args.first)
  # or args.first
  # or block.call(*args)
end
method_id() click to toggle source
# File lib/amq/protocol/client.rb, line 212
def self.method_id
  @method_id
end
methods() click to toggle source
# File lib/amq/protocol/client.rb, line 230
def self.methods
  @methods
end
name() click to toggle source
# File lib/amq/protocol/client.rb, line 216
def self.name
  @name
end
split_headers(user_headers) click to toggle source
# File lib/amq/protocol/client.rb, line 234
def self.split_headers(user_headers)
  properties, headers = {}, {}
  user_headers.each do |key, value|
    # key MUST be a symbol since symbols are not garbage-collected
    if Basic::PROPERTIES.include?(key)
      properties[key] = value
    else
      headers[key] = value
    end
  end

  return [properties, headers]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.