Class: RubocopTodoCorrector::Commands::Describe

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cop_name:, temporary_gemfile_path:) ⇒ Describe

Returns a new instance of Describe.



20
21
22
23
24
25
26
# File 'lib/rubocop_todo_corrector/commands/describe.rb', line 20

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:) ⇒ Object

Parameters:

  • cop_name (String)
  • temporary_gemfile_path (String)


9
10
11
12
13
14
15
16
17
# File 'lib/rubocop_todo_corrector/commands/describe.rb', line 9

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

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rubocop_todo_corrector/commands/describe.rb', line 28

def call
  cop_source_path = CopSourceDetector.call(
    cop_name: @cop_name,
    temporary_gemfile_path: @temporary_gemfile_path
  )
  return unless cop_source_path

  cop_document = CopDocumentParser.call(source_path: cop_source_path)
  return unless cop_document

  cop_url = CopUrlFinder.call(
    cop_name: @cop_name,
    cop_source_path:,
    temporary_gemfile_path: @temporary_gemfile_path
  )
  description = DescriptionRenderer.call(
    cop_document:,
    cop_name: @cop_name,
    cop_url:
  )
  ::Kernel.puts(description)
end