Class: RuboCop::Erb::RubyExtractor
- Inherits:
-
Object
- Object
- RuboCop::Erb::RubyExtractor
- Defined in:
- lib/rubocop/erb/ruby_extractor.rb
Overview
Extract Ruby codes from Erb template.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Array<RuboCop::ProcessedSource>?
-
#initialize(processed_source) ⇒ RubyExtractor
constructor
A new instance of RubyExtractor.
Constructor Details
#initialize(processed_source) ⇒ RubyExtractor
Returns a new instance of RubyExtractor.
20 21 22 |
# File 'lib/rubocop/erb/ruby_extractor.rb', line 20 def initialize(processed_source) @processed_source = processed_source end |
Class Method Details
.call(processed_source) ⇒ Array<RuboCop::ProcessedSource>?
14 15 16 |
# File 'lib/rubocop/erb/ruby_extractor.rb', line 14 def call(processed_source) new(processed_source).call end |
Instance Method Details
#call ⇒ Array<RuboCop::ProcessedSource>?
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubocop/erb/ruby_extractor.rb', line 25 def call return unless supported_file_path_pattern? ruby_clips.map do |ruby_clip| processed_source = ::RuboCop::ProcessedSource.new( ruby_clip.code, @processed_source.ruby_version, file_path ) processed_source.config = @processed_source.config processed_source.registry = @processed_source.registry { offset: ruby_clip.offset, processed_source: processed_source } end end |