Class: RuboCop::TargetRuby
- Inherits:
-
Object
- Object
- RuboCop::TargetRuby
show all
- Defined in:
- lib/rubocop/target_ruby.rb
Overview
The kind of Ruby that code inspected by RuboCop is written in.
Defined Under Namespace
Classes: BundlerLockFile, Default, RuboCopConfig, RubyVersionFile, Source
Constant Summary
collapse
- DEFAULT_VERSION =
KNOWN_RUBIES.first
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ TargetRuby
Returns a new instance of TargetRuby.
130
131
132
|
# File 'lib/rubocop/target_ruby.rb', line 130
def initialize(config)
@config = config
end
|
Class Method Details
.supported_versions ⇒ Object
123
124
125
|
# File 'lib/rubocop/target_ruby.rb', line 123
def self.supported_versions
KNOWN_RUBIES
end
|
Instance Method Details
#rubocop_version_with_support ⇒ Object
146
147
148
149
150
151
152
|
# File 'lib/rubocop/target_ruby.rb', line 146
def rubocop_version_with_support
if supported?
RuboCop::Version.version
else
OBSOLETE_RUBIES[version]
end
end
|
#source ⇒ Object
134
135
136
|
# File 'lib/rubocop/target_ruby.rb', line 134
def source
@source ||= SOURCES.each.lazy.map { |c| c.new(@config) }.detect(&:version)
end
|
#supported? ⇒ Boolean
142
143
144
|
# File 'lib/rubocop/target_ruby.rb', line 142
def supported?
KNOWN_RUBIES.include?(version)
end
|
#version ⇒ Object
138
139
140
|
# File 'lib/rubocop/target_ruby.rb', line 138
def version
source.version
end
|