Class: RuboCop::Slim::RubyExtractor
- Inherits:
-
Object
- Object
- RuboCop::Slim::RubyExtractor
- Defined in:
- lib/rubocop/slim/ruby_extractor.rb
Overview
Extract Ruby codes from Slim 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.
19 20 21 |
# File 'lib/rubocop/slim/ruby_extractor.rb', line 19 def initialize(processed_source) @processed_source = processed_source end |
Class Method Details
.call(processed_source) ⇒ Array<RuboCop::ProcessedSource>?
13 14 15 |
# File 'lib/rubocop/slim/ruby_extractor.rb', line 13 def call(processed_source) new(processed_source).call end |
Instance Method Details
#call ⇒ Array<RuboCop::ProcessedSource>?
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/slim/ruby_extractor.rb', line 24 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 |