Sha256: 68b3f238c4541ba67a7f9a248a01b2e9e7eddc932a8e084d75b80c5653eeefb0

Contents?: true

Size: 587 Bytes

Versions: 17

Compression:

Stored size: 587 Bytes

Contents

require 'axlsx'

module Adhoq
  module Reporter
    class Xlsx

      def self.mime_type
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
      end

      def initialize(result)
        @result = result
      end

      def build_report
        xlsx = Axlsx::Package.new
        write_result!(xlsx)

        xlsx.to_stream
      end

      private

      def write_result!(xlsx)
        xlsx.workbook.add_worksheet do |sheet|
          sheet.add_row @result.header
          @result.rows.each {|row| sheet.add_row row }
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
adhoq-1.0.2 lib/adhoq/reporter/xlsx.rb
adhoq-1.0.1 lib/adhoq/reporter/xlsx.rb
adhoq-1.0.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.5.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.5.0.beta1 lib/adhoq/reporter/xlsx.rb
adhoq-0.4.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.3.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.2.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.1.2 lib/adhoq/reporter/xlsx.rb
adhoq-0.1.1 lib/adhoq/reporter/xlsx.rb
adhoq-0.1.0 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.7 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.6 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.5 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.4 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.3 lib/adhoq/reporter/xlsx.rb
adhoq-0.0.2 lib/adhoq/reporter/xlsx.rb