Updated

app/presenters / petitions_csv_presenter.rb

A
19 lines of codes
2 methods
13.3 complexity/method
2 churn
26.62 complexity
0 duplications
require 'csv' class PetitionsCSVPresenter
  1. 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
  1. PetitionsCSVPresenter#render calls 'presenter_class.fields' 2 times
petitions.in_batches do |petition|
  1. PetitionsCSVPresenter#render contains iterators nested 2 deep
stream << presenter_class.new(petition).to_csv end end end end