Method: Tap::Tasks::Dump#dump_to

Defined in:
lib/tap/tasks/dump.rb

#dump_to(io) ⇒ Object

Dumps the current results in app.aggregator to the io. The dump will include the result audits and a date, as specified in config.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/tap/tasks/dump.rb', line 38

def dump_to(io)
  trails = []
  results = {}
  app.aggregator.to_hash.each_pair do |src, _results|
    next if filter && src.to_s !~ filter
    
    results["#{src} (#{src.object_id})"] = _results.collect {|_audit| _audit._current }
    _results.each {|_audit| trails << _audit._to_s }
  end

  if audit
    io.puts "# audit:"
    trails.each {|trail| io.puts "# #{trail.gsub("\n", "\n# ")}"}
  end
  
  if date
    io.puts "# date: #{Time.now.strftime(date_format)}"
  end
  
  YAML::dump(results, io)
end