Sha256: d34792c5fb84707c8bfada00099ad12fd180498a95a6874c64efccb804cdac65

Contents?: true

Size: 583 Bytes

Versions: 52

Compression:

Stored size: 583 Bytes

Contents

# This class serves as a basic superclass for tabular data specific exports,
# which are organized as tables : a header row and several rows of data.
#
# This allows to only define the `#fields` method in the subclass and let the
# exporter work alone
#
module Para
  module Exporter
    class Table < Para::Exporter::Base
      def headers
        fields.map do |field|
          encode(model.human_attribute_name(field))
        end
      end

      def row_for(resource)
        fields.map do |field|
          encode(resource.send(field))
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
para-0.12.4 lib/para/exporter/table.rb
para-0.12.3 lib/para/exporter/table.rb
para-0.12.2 lib/para/exporter/table.rb
para-0.12.1 lib/para/exporter/table.rb
para-0.12.0 lib/para/exporter/table.rb
para-0.11.4 lib/para/exporter/table.rb
para-0.11.3 lib/para/exporter/table.rb
para-0.11.2 lib/para/exporter/table.rb
para-0.11.1 lib/para/exporter/table.rb
para-0.11.0 lib/para/exporter/table.rb
para-0.10.0 lib/para/exporter/table.rb
para-0.9.4 lib/para/exporter/table.rb
para-0.9.3.3 lib/para/exporter/table.rb
para-0.9.3.2 lib/para/exporter/table.rb
para-0.9.3.1 lib/para/exporter/table.rb
para-0.9.2 lib/para/exporter/table.rb
para-0.9.0 lib/para/exporter/table.rb
para-0.8.15 lib/para/exporter/table.rb
para-0.8.14 lib/para/exporter/table.rb
para-0.8.13 lib/para/exporter/table.rb