Class: Evilution::Reporter::CLI::SectionRenderer

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

Instance Method Summary collapse

Instance Method Details

#call(section, summary) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/evilution/reporter/cli/section_renderer.rb', line 6

def call(section, summary)
  items = section.fetcher.call(summary)
  return [] if items.empty?

  title = section.title.respond_to?(:call) ? section.title.call(items) : section.title
  lines = ["", title]
  items.each { |item| lines << section.formatter.format(item) }
  lines
end