Sha256: a7824177adc3852f92f1b85a89e33767fc37bebe55bbd06eb736865d89ab822b

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 Bytes

Contents

require "scripted/formatters/blank"
require 'scripted/formatters/human_status'


module Scripted
  module Formatters
    class Stats < Blank
      include HumanStatus

      begin
        require 'fastercsv'
        CSV = FasterCSV
      rescue LoadError
        require 'csv'
      end

      def stop(commands, runner)
        if out.is_a?(File)
          CSV.open(out.path, "wb", &csv(commands))
        else
          puts CSV.generate(&csv(commands))
        end
      end

    private

    def csv(commands)
      lambda do |csv|
        csv << ["name", "runtime", "status"]
        commands.each do |command|
          csv << [command.name, command.runtime, human_status(command)]
        end
      end
    end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scripted-0.0.1 lib/scripted/formatters/stats.rb