Created
November 16, 2010 21:04
-
-
Save stevenheidel/702509 to your computer and use it in GitHub Desktop.
11 Objects to Rows or something for Hubble
This file contains hidden or 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
objects = [A, B, C, D, E, F, G, H, I...] # your objects | |
table = [] | |
(objects.length - 1).times do |i| | |
table << objects[i, 2] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns this into that for instance:
ruby-1.9.2-p0 > objects
=> ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
ruby-1.9.2-p0 > table
=> [["a", "b"], ["b", "c"], ["c", "d"], ["d", "e"], ["e", "f"], ["f", "g"], ["g", "h"], ["h", "i"], ["i", "j"], ["j", "k"], ["k", "l"], ["l", "m"], ["m", "n"], ["n", "o"], ["o", "p"], ["p", "q"], ["q", "r"], ["r", "s"], ["s", "t"], ["t", "u"], ["u", "v"], ["v", "w"], ["w", "x"], ["x", "y"], ["y", "z"]]