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
Source
# File lib/rubocop/target_ruby.rb, line 155 def name "`#{RUBY_VERSION_FILENAME}`" end
Private Instance Methods
Source
# File lib/rubocop/target_ruby.rb, line 161 def filename RUBY_VERSION_FILENAME end
Source
# 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
Source
# 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