Sha256: 28517f81a2d786dc958d8d8baf1113d028aa59b99b0e8d6e9ed7034f0b0620ab

Contents?: true

Size: 625 Bytes

Versions: 20

Compression:

Stored size: 625 Bytes

Contents

module Bunny
  # Wraps a delivery tag (which is an integer) so that {Bunny::Channel} could
  # detect stale tags after connection recovery.
  #
  # @private
  class VersionedDeliveryTag
    attr_reader :tag
    attr_reader :version

    def initialize(tag, version)
      raise ArgumentError.new("tag cannot be nil") unless tag
      raise ArgumentError.new("version cannot be nil") unless version

      @tag     = tag
      @version = version
    end

    def to_i
      @tag
    end

    def stale?(version)
      raise ArgumentError.new("version cannot be nil") unless version

      @version < version
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bunny-1.0.3 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.2 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.rc3 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.rc2 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.8 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.rc1 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.7 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.6 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.pre6 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.5 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.pre5 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.4 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.3 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.pre4 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.2 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.1 lib/bunny/versioned_delivery_tag.rb
bunny-0.10.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.0.0.pre3 lib/bunny/versioned_delivery_tag.rb