Sha256: 994f1fa66ed5ae05d9f4eae64a64ccb52f19c510bcd7fc1c73ffd551e35f84f3

Contents?: true

Size: 640 Bytes

Versions: 93

Compression:

Stored size: 640 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.to_i
      @version = version.to_i
    end

    def to_i
      @tag
    end

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

      @version < version.to_i
    end
  end
end

Version data entries

93 entries across 93 versions & 2 rubygems

Version Path
bunny-1.6.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.6.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.5.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.6.0.rc2 lib/bunny/versioned_delivery_tag.rb
bunny-1.6.0.rc1 lib/bunny/versioned_delivery_tag.rb
bunny-1.6.0.pre1 lib/bunny/versioned_delivery_tag.rb
bunny-1.5.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.5.0.pre2 lib/bunny/versioned_delivery_tag.rb
bunny-1.5.0.pre1 lib/bunny/versioned_delivery_tag.rb
bunny-1.4.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.4.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.3.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.3.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.2.2 lib/bunny/versioned_delivery_tag.rb
bunny-1.2.1 lib/bunny/versioned_delivery_tag.rb
bunny-1.2.0 lib/bunny/versioned_delivery_tag.rb
bunny-1.1.9 lib/bunny/versioned_delivery_tag.rb
bunny-1.1.8 lib/bunny/versioned_delivery_tag.rb
bunny-1.1.7 lib/bunny/versioned_delivery_tag.rb
bunny-1.1.6 lib/bunny/versioned_delivery_tag.rb