123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::TargetRuby::RubyVersionFile Private

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RuboCop::TargetRuby::ToolVersionsFile
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Source
Instance Chain:
self, Source
Inherits: RuboCop::TargetRuby::Source
Defined in: lib/rubocop/target_ruby.rb

Overview

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

Constant Summary

Class Method Summary

Source - Inherited

Instance Attribute Summary

Source - Inherited

Instance Method Summary

Source - Inherited

Instance Method Details

#filename (private)

[ GitHub ]

  
# File 'lib/rubocop/target_ruby.rb', line 161

def filename
  RUBY_VERSION_FILENAME
end

#find_version (private)

[ GitHub ]

  
# File 'lib/rubocop/target_ruby.rb', line 169

def find_version
  file = version_file
  return unless file && File.file?(file)

  File.read(file).match(pattern) { |md| md[:version].to_f }
end

#name

[ GitHub ]

  
# File 'lib/rubocop/target_ruby.rb', line 155

def name
  "`#{RUBY_VERSION_FILENAME}`"
end

#pattern (private)

[ GitHub ]

  
# File 'lib/rubocop/target_ruby.rb', line 165

def pattern
  RUBY_VERSION_PATTERN
end

#version_file (private)

[ GitHub ]

  
# File 'lib/rubocop/target_ruby.rb', line 176

def version_file
  @version_file ||= @config.find_file_upwards(filename, @config.base_dir_for_path_parameters)
end