Created
October 7, 2011 07:39
-
-
Save ozzyaaron/1269706 to your computer and use it in GitHub Desktop.
Decorator?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Invoice | |
attr_accessor :a, :b, :c, :name | |
def to_s | |
name | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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