Created
July 30, 2013 19:01
-
-
Save slawosz/6115816 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
array = [['Number', 'Name'], [1, 'Foo'], [2, 'Bar'], [3, 'Baz']] | |
pretty_table(array) | |
# printed result: | |
+--------+--------+ | |
| Number | Name | | |
+--------+--------+ | |
| 1 | Foo | | |
+--------+--------+ | |
| 2 | Bar | | |
+--------+--------+ | |
| 3 | Baz | | |
+--------+--------+ | |
|Number|
|Name |
|1 |
|Foo |
|2 |
|Bar |
|3 |
|Baz |
or
-------
|Number|-------
|Name |-------
|1 |-------
|Foo |-------
|2 |-------
|Bar |-------
|3 |-------
or
-------
|Number|-------
|Name |
-------
|1 |-------
|Foo |
-------
|2 |-------
|Bar |
-------
|3 |-------
|Baz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
array = [['Number', 'Name'], [1, 'Foo'], [2, 'Bar'], [3, 'Baz']]
def pretty_table(array)
end
print pretty_table(array)