Sha256: 6cf92b2d7b625389881891c0a9e66550754b403f7cc3eb6a2279fa07f298423f

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true
module Browser
  module DetectVersion
    private

    def detect_version?(actual_version, expected_version)
      return true unless expected_version

      expected_version = parse_version(expected_version)
      actual_version = parse_version(actual_version)

      Gem::Requirement.create(expected_version)
        .satisfied_by?(Gem::Version.create(actual_version))
    end

    def parse_version(version)
      version.kind_of?(Numeric) ? "#{version}" : version
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browser-2.0.2 lib/browser/detect_version.rb
browser-2.0.1 lib/browser/detect_version.rb