Sha256: a876d3860fa761746381fd1b766a53a3cc8902a5cdeaff5f9f95c84e2ee5496f

Contents?: true

Size: 1.52 KB

Versions: 28

Compression:

Stored size: 1.52 KB

Contents

module GorgonBunny
  # Wraps GorgonAMQ::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

    # Iterates over the returned delivery properties
    # @see Enumerable#each
    def each(*args, &block)
      @hash.each(*args, &block)
    end

    # Accesses returned delivery properties by key
    # @see Hash#[]
    def [](k)
      @hash[k]
    end

    # @return [Hash] Hash representation of this returned delivery info
    def to_hash
      @hash
    end

    # @private
    def to_s
      to_hash.to_s
    end

    # @private
    def inspect
      to_hash.inspect
    end

    # @return [Integer] Reply (status) code of the cause
    def reply_code
      @basic_return.reply_code
    end

    # @return [Integer] Reply (status) text of the cause, explaining why the message was returned
    def reply_text
      @basic_return.reply_text
    end

    # @return [String] Exchange the message was published to
    def exchange
      @basic_return.exchange
    end

    # @return [String] Routing key the message has
    def routing_key
      @basic_return.routing_key
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gorgon-0.11.1 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.11.0 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.5 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.4 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.3 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.2 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.1 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.10.0 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.9.0 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.8.4 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.8.3 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.8.2 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.8.1 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.8.0 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.1 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.0 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.0.rc4 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.0.rc3 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.0.rc2 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb
gorgon-0.7.0.rc1 lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb