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
-
RUBY_VERSION_FILENAME =
# File 'lib/rubocop/target_ruby.rb', line 138'.ruby-version'
-
RUBY_VERSION_PATTERN =
# File 'lib/rubocop/target_ruby.rb', line 139/\A(?:ruby-)?(?<version>\d+\.\d+)/.freeze
Class Method Summary
Instance Attribute Summary
Instance Method Summary
- #name Internal use only
- #filename private Internal use only
- #find_version private Internal use only
- #pattern private Internal use only
- #version_file private Internal use only
Source
- Inherited
Instance Method Details
#filename (private)
[ GitHub ]# File 'lib/rubocop/target_ruby.rb', line 147
def filename RUBY_VERSION_FILENAME end
#find_version (private)
[ GitHub ]# File 'lib/rubocop/target_ruby.rb', line 155
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 141
def name "`#{RUBY_VERSION_FILENAME}`" end
#pattern (private)
[ GitHub ]# File 'lib/rubocop/target_ruby.rb', line 151
def pattern RUBY_VERSION_PATTERN end
#version_file (private)
[ GitHub ]# File 'lib/rubocop/target_ruby.rb', line 162
def version_file @version_file ||= @config.find_file_upwards(filename, @config.base_dir_for_path_parameters) end