From: Joel Pearson Date: 2013-02-19T08:47:31+09:00 Subject: Re: Select "columns" from multidimensional array? Nice catch on the arguments, I completely missed that. After more face-to-keyboard action, I came up with a working filter system. it modifies self at the moment rather than returning a copy, which is something I'll have to look intosince I'm not sure I want that to be the default behaviour. I've added a index option for row and column, and also added row and column methods to String. Since those methods didn't exist before, and you gave me the idea of modifying an existing class (Regexp), I thought this would be quite a useful way to get the index values straight from the hash keys. In order to get the filter working properly I've created some compact methods which will reconfigure the hash keys and values. That could probably be refactored but it took me so long to get it working properly I dare not touch it again yet! I added empty? to the columns and rows as a helper for the compact method. I didn't like the inspect output so I tidied it up a bit as well, and redefined "to_s" for each type. I've added each_with_address as an option for the columns and rows since they don't access the data hash directly. There might be a neater way to implement this, but I couldn't figure it out. I'm too tired for rational thought now so I'd better call it a day before I find myself thinking that adding ASCII art comments in the shape of ponies and rainbows would improve the code... Attachments: http://www.ruby-forum.com/attachment/8153/RubyExcel.rb -- Posted via http://www.ruby-forum.com/.