Sha256: eab0ba2a3c5020c765a7233708428d7b182c207302a7fcd22bbe19cace9d483e

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

module Exporter
  class Exporter
    def self.export(data, options)
      document = exporter.process(data, options)
      raise TypeError.new('process method must return an Document object') unless document.kind_of? Document
      document
    end

    def self.exporter
      @exporter ||= self.new
    end

    protected
    def process(data, options)
      raise NotImplementedError.new("You must implement this process method.")
    end

    def is_active_record?(data, options)
      (data.kind_of? ActiveRecord::Relation) || (data.kind_of?(Array) && data[0].kind_of?(ActiveRecord::Base))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
exporter-0.1.0 lib/exporter/exporter.rb