Sha256: 68cf900963c694423576c50778d0a2d6bc26ff1db3b26e367c9b659e34d4db03

Contents?: true

Size: 1.38 KB

Versions: 12

Compression:

Stored size: 1.38 KB

Contents

module Bunny
  # Wraps basic properties hash as returned by amq-protocol to
  # provide access to the delivery properties as immutable hash as
  # well as methods.
  class MessageProperties

    #
    # Behaviors
    #

    include Enumerable

    #
    # API
    #

    def initialize(properties)
      @properties = properties
    end

    def each(*args, &block)
      @properties.each(*args, &block)
    end

    def [](k)
      @properties[k]
    end

    def to_hash
      @properties
    end

    def to_s
      to_hash.to_s
    end

    def inspect
      to_hash.inspect
    end

    def content_type
      @properties[:content_type]
    end

    def content_encoding
      @properties[:content_encoding]
    end

    def headers
      @properties[:headers]
    end

    def delivery_mode
      @properties[:delivery_mode]
    end

    def priority
      @properties[:priority]
    end

    def correlation_id
      @properties[:correlation_id]
    end

    def reply_to
      @properties[:reply_to]
    end

    def expiration
      @properties[:expiration]
    end

    def message_id
      @properties[:message_id]
    end

    def timestamp
      @properties[:timestamp]
    end

    def type
      @properties[:type]
    end

    def user_id
      @properties[:user_id]
    end

    def app_id
      @properties[:app_id]
    end

    def cluster_id
      @properties[:cluster_id]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bunny-0.9.0.pre13 lib/bunny/message_properties.rb
bunny-0.9.0.pre12 lib/bunny/message_properties.rb
bunny-0.9.0.pre11 lib/bunny/message_properties.rb
bunny-0.9.0.pre10 lib/bunny/message_properties.rb
bunny-0.9.0.pre9 lib/bunny/message_properties.rb
bunny-0.9.0.pre8 lib/bunny/message_properties.rb
bunny-0.9.0.pre7 lib/bunny/message_properties.rb
bunny-0.9.0.pre6 lib/bunny/message_properties.rb
bunny-0.9.0.pre5 lib/bunny/message_properties.rb
bunny-0.9.0.pre4 lib/bunny/message_properties.rb
bunny-0.9.0.pre3 lib/bunny/message_properties.rb
bunny-0.9.0.pre2 lib/bunny/message_properties.rb