Class: Reviewer::Setup::ToolBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/reviewer/setup/tool_block.rb

Overview

Renders the YAML configuration block for a single tool definition. Owns the definition data so rendering methods reference self’s state rather than reaching into parameters.

Constant Summary collapse

YAML_BARE_WORDS =
%w[true false yes no on off null ~].freeze

Instance Method Summary collapse

Constructor Details

#initialize(key, definition, js_runner:) ⇒ ToolBlock

Creates a renderer for a single tool’s YAML configuration block



17
18
19
20
21
# File 'lib/reviewer/setup/tool_block.rb', line 17

def initialize(key, definition, js_runner:)
  @key = key
  @definition = definition
  @js_runner = js_runner
end

Instance Method Details

#to_sString

Renders the full YAML block for this tool



26
27
28
29
30
31
32
# File 'lib/reviewer/setup/tool_block.rb', line 26

def to_s
  lines = header_lines
  lines.concat(commands_block)
  lines.concat(files_block) if @definition[:files]
  lines << ''
  lines.join("\n")
end