Sha256: 2ad668209e9ddee30c1a970771ef059aebc43faf7bb7a9fbefb569b0334bee1b

Contents?: true

Size: 407 Bytes

Versions: 3

Compression:

Stored size: 407 Bytes

Contents

require "csv"

module ActiveReporter
  module Serializer
    class Csv < Table
      def csv_text
        CSV.generate do |csv|
          csv << headers
          each_row { |row| csv << row }
        end
      end

      def save(filename = self.filename)
        File.open(filename, "w") { |f| f.write data }
      end

      def filename
        "#{caption.parameterize}.csv"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_reporter-0.7.1 lib/active_reporter/serializer/csv.rb
active_reporter-0.6.5 lib/active_reporter/serializer/csv.rb
active_reporter-0.6.4 lib/active_reporter/serializer/csv.rb