class ListFormatter

ListFormatter class

Public Class Methods

new(report) click to toggle source
Calls superclass method ArrayFormatter::new
# File lib/teuton/report/formatter/list_formatter.rb, line 7
def initialize(report)
  super(report)
  @data = {}
end

Public Instance Methods

process() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 12
def process
  build_data
  process_config
  process_logs
  process_groups
  process_results
  process_hof
  deinit
end

Private Instance Methods

process_config() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 24
def process_config
  w "CONFIGURATION\n"
  @data[:config].sort.each { |key,value| w "  * #{key} : #{value}\n" }
  w "\n\n"
end
process_group(group) click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 62
def process_group(group)
  tab = '  '
  w "- #{group[:title]}\n"
  group[:targets].each do |i|
    w tab*2 + "#{format("%02d", i[:target_id].to_i)}"
    w " (#{i[:score]}/#{i[:weight]}) "
    w "#{i[:description]}\n"
  end
end
process_groups() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 37
def process_groups
  return if @data[:groups].size == 0

  w "\nGROUPS\n"
  @data[:groups].each { |g| process_group g }
end
process_hof() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 51
def process_hof
  return if @data[:hall_of_fame].size < 3

  w "\nHALL OF FAME\n"
  @data[:hall_of_fame].each do |line|
    w "  #{line[0]} #{line[1]}\n"
  end
end
process_logs() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 30
def process_logs
  return if @data[:logs].size == 0

  w "\nLOGS\n"
  @data[:logs].each { |line| w "  * #{line}\n" }
end
process_results() click to toggle source
# File lib/teuton/report/formatter/list_formatter.rb, line 44
def process_results
  w "\nRESULTS\n"
  @data[:results].each do |key,value|
    w "  * #{key.to_s} : #{value.to_s}\n"
  end
end