Sha256: 2eadb7558cf9e154cefbb6e4896716cc49cf2e4764944cba006e86b367011e66

Contents?: true

Size: 1022 Bytes

Versions: 12

Compression:

Stored size: 1022 Bytes

Contents

module Bunny
  # Wraps AMQ::Protocol::Basic::Return to
  # provide access to the delivery properties as immutable hash as
  # well as methods.
  class ReturnInfo

    #
    # Behaviors
    #

    include Enumerable

    #
    # API
    #

    def initialize(basic_return)
      @basic_return = basic_return
      @hash          = {
        :reply_code   => basic_return.reply_code,
        :reply_text   => basic_return.reply_text,
        :exchange     => basic_return.exchange,
        :routing_key  => basic_return.routing_key
      }
    end

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

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

    def to_hash
      @hash
    end

    def to_s
      to_hash.to_s
    end

    def inspect
      to_hash.inspect
    end

    def reply_code
      @basic_return.reply_code
    end

    def reply_text
      @basic_return.reply_text
    end

    def exchange
      @basic_return.exchange
    end

    def routing_key
      @basic_return.routing_key
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

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