I'm not sure how to write this code more cleanly in ruby? The only thing that differs is the iterator.
if items.respond_to?(:find_each)
items.find_each do |item|
output_item(csv, item)
end
else
items.each do |item|
output_item(csv, item)
end
end