From: Chris Morales Date: 2007-11-26T08:39:12+09:00 Subject: Re: How to give depth to arrays? Wow! Thanks everybody & Thank you so much Eric > class Array > def depthen > base_depth = first > result = [] > > each do |depth| > array_end = result > (depth - base_depth).times do > array_end << [] unless array_end.last.kind_of? Array > array_end = array_end.last > end > array_end << depth > end > > result > end > end I couldn't have dreamt a shorter way to achieve this, You really are a Genius. So short and nice! This must be what they call the ruby way I think ;) Chris. -- Posted via http://www.ruby-forum.com/.