Sha256: 7faade39751263fe5f1faa00bce4d139411ae38c17a49615271c54e5b21d400b

Contents?: true

Size: 948 Bytes

Versions: 21

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_formatter'

# ArrayFormatter class: format report data into an array
class ResumeArrayFormatter < BaseFormatter
  def initialize(report)
    super(report)
    @data = {}
  end

  def process
    build_data
    w @data.to_s # Write data into ouput file
    deinit
  end

  def build_data
    build_initial_data
    build_cases_data
    build_final_data
    build_hof_data
  end

  def build_initial_data
    head = {}
    @head.each { |key, value| head[key] = value }
    @data[:config] = head
  end

  def build_cases_data
    @data[:cases] = @lines
  end

  def build_final_data
    tail = {}
    @tail.each { |key, value| tail[key] = value }
    @data[:results] = tail
  end

  def build_hof_data
    app = Application.instance
    fame = {}
    if app.options[:case_number] > 2
      app.hall_of_fame.each { |line| fame[line[0]] = line[1] }
    end
    @data[:hall_of_fame] = fame
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
teuton-2.3.6 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.3.5 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.3.4 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.3.3 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.3.2 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.3.1 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.2.2 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.11 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.10 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.9 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.8 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.8dev1 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.7 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.6 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.5dev lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.4 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.3 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.2 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.1 lib/teuton/report/formatter/resume_array_formatter.rb
teuton-2.1.0 lib/teuton/report/formatter/resume_array_formatter.rb