Sha256: 75f5c0dcf0d1d4cfa255e9965d4b210134809b47780eac16ec89c42bb485ddfe

Contents?: true

Size: 407 Bytes

Versions: 10

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

10 entries across 10 versions & 1 rubygems

Version Path
active_reporter-0.6.3 lib/active_reporter/serializer/csv.rb
active_reporter-0.6.2 lib/active_reporter/serializer/csv.rb
active_reporter-0.6.1 lib/active_reporter/serializer/csv.rb
active_reporter-0.6.0 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.13 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.12 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.11 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.10 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.9 lib/active_reporter/serializer/csv.rb
active_reporter-0.5.8 lib/active_reporter/serializer/csv.rb