From: Joel Pearson Date: 2013-02-15T07:50:59+09:00 Subject: Re: Select "columns" from multidimensional array? Interesting Matrix build. It's giving me a bit of a headache just trying to figure out the links involved. So MatrixPart defines the methods and the "parent" matrix (held as an instance variable); and row and column both use these methods and both access the variable which points to the matrix they're part of. The rows and columns can be selected based on given headers, and each will reference the other... and this is where my head explodes: def index( row, col ) @row_headers.index( row ) * @col_headers.size + @col_headers.index( col ) end It takes a bit of getting used to, but thanks to Ruby's flexible array class adding nil values automatically when you specify an index higher than the upper boundary, that works. I guess with a bit more poking and prodding I could figure out how to append, insert, and delete rows and columns. After all, it's only a math problem in the end. All the interconnected references (especially the layered yields) still make my head spin though :) -- Posted via http://www.ruby-forum.com/.