Skip to content

Instantly share code, notes, and snippets.

@agentfin
Created December 21, 2011 05:15
Show Gist options
  • Save agentfin/1504691 to your computer and use it in GitHub Desktop.
Save agentfin/1504691 to your computer and use it in GitHub Desktop.
Table of Content... CP
# table of contentssss
line_width = 40
puts ('Table of Contents'.center(line_width))
table = [
[1, 'Getting Started', 1],
[2, 'Numbers', 9],
[3, 'Letters', 13]
]
table.each do |chapter, title, page|
c = "Chapter: #{chapter}".ljust 15
t = "#{title}".ljust 20
p = "page #{page}".rjust 10
puts c + t + p
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment