Sha256: addf0e0b2bfa3ee3440d88079e1a50575a399020ed24661d6e66e2431bc77689
Contents?: true
Size: 576 Bytes
Versions: 15
Compression:
Stored size: 576 Bytes
Contents
require 'json' module Adhoq module Reporter class Json def self.mime_type 'application/json' end def initialize(result) @result = result end def build_report file = Tempfile.new(['adhoq-reporter', '.csv'], Dir.tmpdir, encoding: 'UTF-8') write_content!(file) file.tap(&:rewind) end private def write_content!(file) json_objects = @result.rows.map {|row| Hash[*@result.header.zip(row).flatten] } file.write(JSON.dump(json_objects)) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems