Class: RuboCop::Erb::ProcessedSourceBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/erb/processed_source_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, processed_source:) ⇒ ProcessedSourceBuilder

Returns a new instance of ProcessedSourceBuilder.



23
24
25
26
27
28
29
# File 'lib/rubocop/erb/processed_source_builder.rb', line 23

def initialize(
  code:,
  processed_source:
)
  @code = code
  @processed_source = processed_source
end

Class Method Details

.call(code:, processed_source:) ⇒ RuboCop::ProcessedSource

Creates a new ProcessedSource, inheriting state from a donor.

Parameters:

  • code (String)
  • processed_source (RuboCop::ProcessedSource)

Returns:

  • (RuboCop::ProcessedSource)


12
13
14
15
16
17
18
19
20
# File 'lib/rubocop/erb/processed_source_builder.rb', line 12

def call(
  code:,
  processed_source:
)
  new(
    code: code,
    processed_source: processed_source
  ).call
end

Instance Method Details

#callObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubocop/erb/processed_source_builder.rb', line 31

def call
  new_processed_source = ::RuboCop::ProcessedSource.new(
    @code,
    @processed_source.ruby_version,
    @processed_source.path,
    **keyword_arguments
  )
  new_processed_source.config = @processed_source.config
  new_processed_source.registry = @processed_source.registry
  new_processed_source
end