Skip to content

Instantly share code, notes, and snippets.

@ozzyaaron
Created October 7, 2011 07:39
Show Gist options
  • Save ozzyaaron/1269706 to your computer and use it in GitHub Desktop.
Save ozzyaaron/1269706 to your computer and use it in GitHub Desktop.
Decorator?
class Invoice
attr_accessor :a, :b, :c, :name
def to_s
name
end
end
class Report
class Invoice < ::Invoice
def to_s
[name]
end
end
def build_csv
# CSV Setup
#
# csv.is_a? Array
# => true
#
csv += Invoice.all.inject([]) do |lines, invoice|
lines << invoice
end
# CSV Finish
#
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment