class RuboCop::TargetRuby::RubyVersionFile
The target ruby version may be found in a .ruby-version file. @api private
Constants
- RUBY_VERSION_FILENAME
- RUBY_VERSION_PATTERN
Public Instance Methods
name()
click to toggle source
# File lib/rubocop/target_ruby.rb, line 56 def name "`#{RUBY_VERSION_FILENAME}`" end
Private Instance Methods
filename()
click to toggle source
# File lib/rubocop/target_ruby.rb, line 62 def filename RUBY_VERSION_FILENAME end
find_version()
click to toggle source
# File lib/rubocop/target_ruby.rb, line 70 def find_version file = version_file return unless file && File.file?(file) File.read(file).match(pattern) { |md| md[:version].to_f } end
pattern()
click to toggle source
# File lib/rubocop/target_ruby.rb, line 66 def pattern RUBY_VERSION_PATTERN end
version_file()
click to toggle source
# File lib/rubocop/target_ruby.rb, line 77 def version_file @version_file ||= @config.find_file_upwards(filename, @config.base_dir_for_path_parameters) end