Class: WebMock::VersionChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/webmock/util/version_checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(library_name, library_version, min_patch_level, max_minor_version = nil, unsupported_versions = []) ⇒ VersionChecker

Returns a new instance of VersionChecker.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/webmock/util/version_checker.rb', line 29

def initialize(library_name, library_version, min_patch_level, max_minor_version = nil, unsupported_versions = [])
  @library_name, @library_version = library_name, library_version
  @min_patch_level, @max_minor_version = min_patch_level, max_minor_version
  @unsupported_versions = unsupported_versions || []

  @major,     @minor,     @patch     = parse_version(library_version)
  @min_major, @min_minor, @min_patch = parse_version(min_patch_level)
  if max_minor_version
    @max_major, @max_minor           = parse_version(max_minor_version)
  else
    @max_major, @max_minor           = nil, nil
  end

  @comparison_result = compare_version
end

Instance Method Details

#check_version!Object



45
46
47
48
49
# File 'lib/webmock/util/version_checker.rb', line 45

def check_version!
  warn_about_too_low if too_low?
  warn_about_too_high if too_high?
  warn_about_unsupported_version if unsupported_version?
end