Class: RubyChecker::Versions

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_checker/versions.rb

Overview

Versions performs checks on the given versions (current and supported).

Instance Method Summary collapse

Constructor Details

#initialize(current:, supported:) ⇒ Versions

Returns a new instance of Versions.



26
27
28
29
30
# File 'lib/ruby_checker/versions.rb', line 26

def initialize(current:, supported:)
  @current   = current
  @supported = supported
  @logger    = Logger.new
end

Instance Method Details

#check!Object

check! performs tests for the current and the supported versions of ruby. It returns true if nothing bad is happening, false if there was a warning, and it will raise an OutdatedRubyError if the version mismatch is unbearable.



36
37
38
39
40
41
42
43
44
# File 'lib/ruby_checker/versions.rb', line 36

def check!
  if @current > @supported
    check_newer_versions
  elsif @current < @supported
    check_older_versions!
  else
    true
  end
end