Class: AMQ::Protocol::Method

### Home Classes Methods

### In Files

- lib/amq/protocol/client.rb

### Parent

Object

### Methods

- ::encode_body
- ::index
- ::inherited
- ::instantiate
- ::method_id
- ::methods
- ::name
- ::split_headers

### Class/Module Index

Quicksearch

- AMQ
- AMQ::BitSet
- AMQ::Endianness
- AMQ::Hacks
- AMQ::IntAllocator
- AMQ::Pack
- AMQ::Protocol
- AMQ::Protocol::AccessRefused
- AMQ::Protocol::BadResponseError
- AMQ::Protocol::Basic
- AMQ::Protocol::Basic::Ack
- AMQ::Protocol::Basic::Cancel
- AMQ::Protocol::Basic::CancelOk
- AMQ::Protocol::Basic::Consume
- AMQ::Protocol::Basic::ConsumeOk
- AMQ::Protocol::Basic::Deliver
- AMQ::Protocol::Basic::Get
- AMQ::Protocol::Basic::GetEmpty
- AMQ::Protocol::Basic::GetOk
- AMQ::Protocol::Basic::Nack
- AMQ::Protocol::Basic::Publish
- AMQ::Protocol::Basic::Qos
- AMQ::Protocol::Basic::QosOk
- AMQ::Protocol::Basic::Recover
- AMQ::Protocol::Basic::RecoverAsync
- AMQ::Protocol::Basic::RecoverOk
- AMQ::Protocol::Basic::Reject
- AMQ::Protocol::Basic::Return
- AMQ::Protocol::BodyFrame
- AMQ::Protocol::Channel
- AMQ::Protocol::Channel::Close
- AMQ::Protocol::Channel::CloseOk
- AMQ::Protocol::Channel::Flow
- AMQ::Protocol::Channel::FlowOk
- AMQ::Protocol::Channel::Open
- AMQ::Protocol::Channel::OpenOk
- AMQ::Protocol::ChannelError
- AMQ::Protocol::Class
- AMQ::Protocol::CommandInvalid
- AMQ::Protocol::Confirm
- AMQ::Protocol::Confirm::Select
- AMQ::Protocol::Confirm::SelectOk
- AMQ::Protocol::Connection
- AMQ::Protocol::Connection::Blocked
- AMQ::Protocol::Connection::Close
- AMQ::Protocol::Connection::CloseOk
- AMQ::Protocol::Connection::Open
- AMQ::Protocol::Connection::OpenOk
- AMQ::Protocol::Connection::Secure
- AMQ::Protocol::Connection::SecureOk
- AMQ::Protocol::Connection::Start
- AMQ::Protocol::Connection::StartOk
- AMQ::Protocol::Connection::Tune
- AMQ::Protocol::Connection::TuneOk
- AMQ::Protocol::Connection::Unblocked
- AMQ::Protocol::ConnectionForced
- AMQ::Protocol::ContentTooLarge
- AMQ::Protocol::EmptyResponseError
- AMQ::Protocol::Error
- AMQ::Protocol::Exchange
- AMQ::Protocol::Exchange::Bind
- AMQ::Protocol::Exchange::BindOk
- AMQ::Protocol::Exchange::Declare
- AMQ::Protocol::Exchange::DeclareOk
- AMQ::Protocol::Exchange::Delete
- AMQ::Protocol::Exchange::DeleteOk
- AMQ::Protocol::Exchange::Unbind
- AMQ::Protocol::Exchange::UnbindOk
- AMQ::Protocol::Float32Bit
- AMQ::Protocol::Frame
- AMQ::Protocol::FrameError
- AMQ::Protocol::FrameSubclass
- AMQ::Protocol::FrameTypeError
- AMQ::Protocol::HardError
- AMQ::Protocol::HeaderFrame
- AMQ::Protocol::HeartbeatFrame
- AMQ::Protocol::InternalError
- AMQ::Protocol::InvalidPath
- AMQ::Protocol::Method
- AMQ::Protocol::MethodFrame
- AMQ::Protocol::NoConsumers
- AMQ::Protocol::NoRoute
- AMQ::Protocol::NotAllowed
- AMQ::Protocol::NotFound
- AMQ::Protocol::NotImplemented
- AMQ::Protocol::PreconditionFailed
- AMQ::Protocol::Queue
- AMQ::Protocol::Queue::Bind
- AMQ::Protocol::Queue::BindOk
- AMQ::Protocol::Queue::Declare
- AMQ::Protocol::Queue::DeclareOk
- AMQ::Protocol::Queue::Delete
- AMQ::Protocol::Queue::DeleteOk
- AMQ::Protocol::Queue::Purge
- AMQ::Protocol::Queue::PurgeOk
- AMQ::Protocol::Queue::Unbind
- AMQ::Protocol::Queue::UnbindOk
- AMQ::Protocol::ResourceError
- AMQ::Protocol::ResourceLocked
- AMQ::Protocol::SoftError
- AMQ::Protocol::SyntaxError
- AMQ::Protocol::Table
- AMQ::Protocol::Table::InvalidTableError
- AMQ::Protocol::TableValueDecoder
- AMQ::Protocol::TableValueEncoder
- AMQ::Protocol::Tx
- AMQ::Protocol::Tx::Commit
- AMQ::Protocol::Tx::CommitOk
- AMQ::Protocol::Tx::Rollback
- AMQ::Protocol::Tx::RollbackOk
- AMQ::Protocol::Tx::Select
- AMQ::Protocol::Tx::SelectOk
- AMQ::Protocol::TypeConstants
- AMQ::Protocol::UnexpectedFrame
- AMQ::URI

No matching classes.

# AMQ::Protocol::Method

### Public Class Methods

encode_body(body, channel, frame_size) click to toggle source

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

      # 8 = 1 + 2 + 4 + 1
      # 1 byte of frame type
      # 2 bytes of channel number
      # 4 bytes of frame payload length
      # 1 byte of payload trailer FRAME_END byte
      limit        = frame_size - 8
      return [BodyFrame.new(body, channel)] if body.bytesize < limit

      # Otherwise String#slice on 1.9 will operate with code points,
      # and we need bytes. MK.
      body.force_encoding("ASCII-8BIT") if RUBY_VERSION.to_f >= 1.9

      array = Array.new
      while body && !body.empty?
        payload, body = body[0, limit], body[limit, body.length - limit]
        array << BodyFrame.new(payload, channel)
      end

      array
    end

index() click to toggle source

    # File lib/amq/protocol/client.rb, line 135
    def self.index
      @index
    end

inherited(base) click to toggle source

    # File lib/amq/protocol/client.rb, line 139
    def self.inherited(base)
      if self == Protocol::Method
        @methods << base
      end
    end

instantiate(*args, &block) click to toggle source

    # File lib/amq/protocol/client.rb, line 187
    def self.instantiate(*args, &block)
      self.new(*args, &block)
    end

method_id() click to toggle source

    # File lib/amq/protocol/client.rb, line 127
    def self.method_id
      @method_id
    end

methods() click to toggle source

    # File lib/amq/protocol/client.rb, line 145
    def self.methods
      @methods
    end

name() click to toggle source

    # File lib/amq/protocol/client.rb, line 131
    def self.name
      @name
    end

split_headers(user_headers) click to toggle source

    # File lib/amq/protocol/client.rb, line 149
    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.