Skip to content

Instantly share code, notes, and snippets.

@knowuh
Created October 6, 2010 15:57
Show Gist options
  • Save knowuh/613567 to your computer and use it in GitHub Desktop.
Save knowuh/613567 to your computer and use it in GitHub Desktop.
def csv(obj, fields)
fields = fields.kind_of?(String) ? fields.split : fields
obj.each do |o|
results = fields.map { |f| o.send(f.to_sym) }
puts results.join(", ")
end
nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment