Skip to content

Instantly share code, notes, and snippets.

@martenlienen
Created April 1, 2013 19:38
Show Gist options
  • Save martenlienen/5287157 to your computer and use it in GitHub Desktop.
Save martenlienen/5287157 to your computer and use it in GitHub Desktop.
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