Sha256: 4743a6b98f26816b18544f8001177aedeb3f92f306d7a1c25267d03af3fa1f05
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
require 'active_record' require "csv" require "exporter/version" require "exporter/configuration" require "exporter/document" require "exporter/exporter" require "exporter/documents/csv_document" require 'exporter/documents/excel_document' require "exporter/exporters/csv_exporter" require "exporter/exporters/excel_exporter" module Exporter def self.configuration @configuration ||= Configuration.new end def self.export(data, export_type, options={}) exporter = @configuration.exporter(data, export_type) if exporter exporter.export(data, options) else raise ArgumentError.new("Not support this data type: #{data.class} ") end end end Exporter.configuration.register(Array, :csv, Exporter::CsvExporter) Exporter.configuration.register(ActiveRecord::Relation, :csv, Exporter::CsvExporter) Exporter.configuration.register(Array, :excel, Exporter::ExcelExporter) Exporter.configuration.register(ActiveRecord::Relation, :excel, Exporter::ExcelExporter)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exporter-0.1.0 | lib/exporter.rb |