Created
December 21, 2011 05:15
-
-
Save agentfin/1504691 to your computer and use it in GitHub Desktop.
Table of Content... CP
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
# 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