Module: RubyVersionCheck

Defined in:
lib/ruby_version_check.rb

Class Method Summary collapse

Class Method Details

.ruby_version2?Boolean

Allows maintaining version compatibility with older versions of Ruby :nocov:

Returns:

  • (Boolean)


6
7
8
9
10
11
# File 'lib/ruby_version_check.rb', line 6

def self.ruby_version2?
  @ruby_version2 ||= (
      Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.0.0") &&
      Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
  )
end

.ruby_version3?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ruby_version_check.rb', line 13

def self.ruby_version3?
  @ruby_version3 ||= (Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0"))
end