Sha256: bdb490594fed65f05aea626c8ed7cc8b3febd07e23e82a4cdd9e427b1f6058ba

Contents?: true

Size: 626 Bytes

Versions: 15

Compression:

Stored size: 626 Bytes

Contents

# frozen_string_literal: true

module Browser
  module DetectVersion
    private def detect_version?(actual_version, expected_version)
      return true unless expected_version
      return false if expected_version && !actual_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))
    rescue ArgumentError
      false
    end

    private def parse_version(version)
      version.is_a?(Numeric) ? version.to_s : version
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
browser-6.1.0 lib/browser/detect_version.rb
browser-6.0.0 lib/browser/detect_version.rb
browser-5.3.1 lib/browser/detect_version.rb
browser-5.3.0 lib/browser/detect_version.rb
browser-5.2.0 lib/browser/detect_version.rb
browser-5.1.0 lib/browser/detect_version.rb
browser-5.0.0 lib/browser/detect_version.rb
browser-4.2.0 lib/browser/detect_version.rb
browser-4.1.0 lib/browser/detect_version.rb
browser-4.0.0 lib/browser/detect_version.rb
browser-3.0.3 lib/browser/detect_version.rb
browser-3.0.2 lib/browser/detect_version.rb
browser-3.0.1 lib/browser/detect_version.rb
browser-3.0.0 lib/browser/detect_version.rb
browser-2.7.1 lib/browser/detect_version.rb