Class: RuboCop::TargetRuby Private
- Inherits:
-
Object
- Object
- RuboCop::TargetRuby
- Defined in:
- lib/rubocop/target_ruby.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The kind of Ruby that code inspected by RuboCop is written in.
Defined Under Namespace
Classes: BundlerLockFile, Default, GemspecFile, MiseTomlFile, RuboCopConfig, RuboCopEnvVar, RubyVersionFile, Source, ToolVersionsFile
Constant Summary collapse
- DEFAULT_VERSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
2.7
Class Method Summary collapse
- .supported_versions ⇒ Object private
Instance Method Summary collapse
-
#initialize(config) ⇒ TargetRuby
constructor
private
A new instance of TargetRuby.
- #rubocop_version_with_support ⇒ Object private
- #source ⇒ Object private
- #supported? ⇒ Boolean private
- #version ⇒ Object private
Constructor Details
#initialize(config) ⇒ TargetRuby
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TargetRuby.
300 301 302 |
# File 'lib/rubocop/target_ruby.rb', line 300 def initialize(config) @config = config end |
Class Method Details
.supported_versions ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
284 285 286 |
# File 'lib/rubocop/target_ruby.rb', line 284 def self.supported_versions KNOWN_RUBIES end |
Instance Method Details
#rubocop_version_with_support ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
316 317 318 319 320 321 322 |
# File 'lib/rubocop/target_ruby.rb', line 316 def rubocop_version_with_support if supported? RuboCop::Version::STRING else OBSOLETE_RUBIES[version] end end |
#source ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
304 305 306 |
# File 'lib/rubocop/target_ruby.rb', line 304 def source @source ||= SOURCES.each.lazy.map { |c| c.new(@config) }.detect(&:version) end |
#supported? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
312 313 314 |
# File 'lib/rubocop/target_ruby.rb', line 312 def supported? KNOWN_RUBIES.include?(version) end |
#version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
308 309 310 |
# File 'lib/rubocop/target_ruby.rb', line 308 def version source.version end |