Class: Evilution::Reporter::CLI Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/cli.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: ItemFormatters, LineFormatters Classes: MetricsBlock, Pct, Section, SectionRenderer, Trailer

Constant Summary collapse

SEPARATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"=" * 44

Instance Method Summary collapse

Constructor Details

#initialize(header: LineFormatters::Header.new, metrics_block: MetricsBlock.new, section_renderer: SectionRenderer.new, sections: DEFAULT_SECTIONS, trailer: Trailer.new) ⇒ CLI

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CLI.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/evilution/reporter/cli.rb', line 8

def initialize(
  header: LineFormatters::Header.new,
  metrics_block: MetricsBlock.new,
  section_renderer: SectionRenderer.new,
  sections: DEFAULT_SECTIONS,
  trailer: Trailer.new
)
  @header = header
  @metrics_block = metrics_block
  @section_renderer = section_renderer
  @sections = sections
  @trailer = trailer
end

Instance Method Details

#call(summary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/evilution/reporter/cli.rb', line 22

def call(summary)
  lines = []
  lines << @header.format(summary)
  lines << SEPARATOR
  lines << ""
  lines.concat(@metrics_block.call(summary))
  @sections.each { |section| lines.concat(@section_renderer.call(section, summary)) }
  lines << ""
  lines.concat(@trailer.call(summary))
  lines.join("\n")
end