class Lite::Report::Exporter
Attributes
records[R]
Public Class Methods
call(records)
click to toggle source
# File lib/lite/report/exporter.rb, line 15 def call(records) instance = new(records) instance.call end
new(records)
click to toggle source
# File lib/lite/report/exporter.rb, line 9 def initialize(records) @records = records end
Public Instance Methods
call()
click to toggle source
# File lib/lite/report/exporter.rb, line 22 def call results = [] if records.respond_to?(:find_each) records.find_each { |record| results << serialize(record) } elsif records.respond_to?(:each) records.each { |record| results << serialize(record) } else results << serialize(records) end results end
Private Instance Methods
serialize(record)
click to toggle source
# File lib/lite/report/exporter.rb, line 38 def serialize(record) raise NotImplementedError end