Class: RubocopTodoCorrector::CopSourceDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_todo_corrector/cop_source_detector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cop_name:, temporary_gemfile_path:) ⇒ CopSourceDetector

Returns a new instance of CopSourceDetector.



22
23
24
25
26
27
28
# File 'lib/rubocop_todo_corrector/cop_source_detector.rb', line 22

def initialize(
  cop_name:,
  temporary_gemfile_path:
)
  @cop_name = cop_name
  @temporary_gemfile_path = temporary_gemfile_path
end

Class Method Details

.call(cop_name:, temporary_gemfile_path:) ⇒ String?

Parameters:

  • cop_name (String)
  • temporary_gemfile_path (String)

Returns:

  • (String, nil)


11
12
13
14
15
16
17
18
19
# File 'lib/rubocop_todo_corrector/cop_source_detector.rb', line 11

def call(
  cop_name:,
  temporary_gemfile_path:
)
  new(
    cop_name:,
    temporary_gemfile_path:
  ).call
end

Instance Method Details

#callString?

Returns:

  • (String, nil)


31
32
33
34
# File 'lib/rubocop_todo_corrector/cop_source_detector.rb', line 31

def call
  output = capture
  output unless output.empty?
end