Class: RubocopTodoCorrector::DescriptionRenderer

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

Constant Summary collapse

TEMPLATE_PATH =
::File.expand_path('../../templates/description.md.erb', __dir__)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cop_document:, cop_name:, cop_url:) ⇒ DescriptionRenderer

Returns a new instance of DescriptionRenderer.



29
30
31
32
33
34
35
36
37
# File 'lib/rubocop_todo_corrector/description_renderer.rb', line 29

def initialize(
  cop_document:,
  cop_name:,
  cop_url:
)
  @cop_document = cop_document
  @cop_name = cop_name
  @cop_url = cop_url
end

Class Method Details

.call(cop_document:, cop_name:, cop_url:) ⇒ String

Parameters:

  • cop_document (String)
  • cop_name (String)
  • cop_url (String)

Returns:

  • (String)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubocop_todo_corrector/description_renderer.rb', line 16

def call(
  cop_document:,
  cop_name:,
  cop_url:
)
  new(
    cop_document:,
    cop_name:,
    cop_url:
  ).call
end

Instance Method Details

#callString

Returns:

  • (String)


40
41
42
# File 'lib/rubocop_todo_corrector/description_renderer.rb', line 40

def call
  ::ERB.new(template_content, trim_mode: '-').result(binding)
end