class RuboCop::TargetRuby::RubyVersionFile

@api private
The target ruby version may be found in a .ruby-version file.

def find_version

def find_version
  file = ruby_version_file
  return unless file && File.file?(file)
  # rubocop:disable Lint/MixedRegexpCaptureTypes
  # `(ruby-)` is not a capture type.
  File.read(file).match(/\A(ruby-)?(?<version>\d+\.\d+)/) do |md|
    # rubocop:enable Lint/MixedRegexpCaptureTypes
    md[:version].to_f
  end
end

def name

def name
  "`#{FILENAME}`"
end

def ruby_version_file

def ruby_version_file
  @ruby_version_file ||=
    @config.find_file_upwards(FILENAME,
                              @config.base_dir_for_path_parameters)
end