module AbcSize::RubyVersion::Common

common methods

Public Instance Methods

return_supported_version_if_version_supported(version) click to toggle source
# File lib/abc_size/ruby_version.rb, line 9
def return_supported_version_if_version_supported(version)
  supported_version = RubyVersion::SUPPORTED_VERSIONS.include?(version) ? version : nil
  raise UnsupportedVersionError, 'Unsupported Ruby version given.' if supported_version.nil?

  supported_version
rescue UnsupportedVersionError => e
  puts "#{e.message}\n"\
       "Supported versions: #{RubyVersion::SUPPORTED_VERSIONS}"
  exit
end