require 'csv'
class PetitionsCSVPresenter - PetitionsCSVPresenter has no descriptive comment
attr_reader :petitions, :presenter_class
def initialize(petitions, presenter_class: PetitionCSVPresenter)
@petitions, @presenter_class = petitions, presenter_class
end
def render
Enumerator.new do |stream|
stream << CSV::Row.new(presenter_class.fields, presenter_class.fields, true).to_s - PetitionsCSVPresenter#render calls 'presenter_class.fields' 2 times
petitions.in_batches do |petition| - PetitionsCSVPresenter#render contains iterators nested 2 deep
stream << presenter_class.new(petition).to_csv
end
end
end
end