Sha256: 064f0351fb9b7b3dfd1a2d2285c188279c63f7ef2c0010965f36a2ddb302d119

Contents?: true

Size: 609 Bytes

Versions: 34

Compression:

Stored size: 609 Bytes

Contents

module Messaging
  class ExpectedVersion
    Error = Class.new(StandardError)

    attr_reader :version

    def initialize(version)
      @version = version
    end

    def any?
      version == :any
    end

    def none?
      version == :none || version == -1
    end

    def matches?(other_version)
      return true if any?
      return true if none? && other_version == -1
      return true if version == other_version
      false
    end

    def match!(other_version)
      return true if matches?(other_version)
      raise Error, "expected: #{version} actual: #{other_version}"
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
messaging-4.0.12 lib/messaging/expected_version.rb
messaging-4.0.11 lib/messaging/expected_version.rb
messaging-4.0.10 lib/messaging/expected_version.rb
messaging-4.0.10.pre lib/messaging/expected_version.rb
messaging-4.0.9 lib/messaging/expected_version.rb
messaging-4.0.8 lib/messaging/expected_version.rb
messaging-4.0.7 lib/messaging/expected_version.rb
messaging-4.0.6 lib/messaging/expected_version.rb
messaging-4.0.5 lib/messaging/expected_version.rb
messaging-4.0.4.pre lib/messaging/expected_version.rb
messaging-4.0.3.pre lib/messaging/expected_version.rb
messaging-4.0.2.pre lib/messaging/expected_version.rb
messaging-4.0.1.pre lib/messaging/expected_version.rb
messaging-4.0.0.pre lib/messaging/expected_version.rb
messaging-3.8.2 lib/messaging/expected_version.rb
messaging-3.8.1 lib/messaging/expected_version.rb
messaging-3.8.0 lib/messaging/expected_version.rb
messaging-3.7.3 lib/messaging/expected_version.rb
messaging-3.7.2 lib/messaging/expected_version.rb
messaging-3.7.1 lib/messaging/expected_version.rb