Created
April 1, 2013 19:38
-
-
Save martenlienen/5287157 to your computer and use it in GitHub Desktop.
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 TableDocument | |
def to_pdf | |
add_text document_title | |
add_table [table_header] + table_data | |
render | |
end | |
def document_title | |
end | |
def table_header | |
end | |
def table_data | |
end | |
end | |
class ShoppingList < TableDocument | |
def document_title | |
"Shopping List" | |
end | |
def table_header | |
["Ingredient", "Amount"] | |
end | |
def table_data | |
[["Banana", "1"], | |
["Ham", "5"]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment