From: "Rin Zebramädchen" Date: 2010-10-15T06:57:28+09:00 Subject: Re: Kind of nested loops On Thu, Oct 14, 2010 at 11:30 PM, Veedo Dream wrote: > I am trying to get this going where i have this build array and then I > have an array of hashes named after the items in the build. Depending > upon what is in the array, I want to read the arrays of hashes. I wrote > this simple script, but does not work. Any solns > build = [ "log " , >          "top"  ] > > > log = [ > >     { 'where'                    =>  '/home/des/blocks/where.rb'}, >     { 'when'                     =>  '/home/des/blocks/when.rb'}, >     { 'bank'                     =>  '/home/des/blocks/bank.rb'} > ] > top = [ > >     { 'where'                    =>  '/home/top/blocks/where.rb'}, >     { 'when'                     =>  '/home/top/blocks/when.rb'}, >     { 'bank'                     =>  '/home/top/blocks/bank.rb'} > ] > > > build.each{ |bu| >    puts bu >    bu.each{ |files| >      puts files > > }} > > -- > Posted via http://www.ruby-forum.com/. > > Maybe I'm missing the point (not quite sure if I got what you want to do), but how about this? log = [ { :where => '/home/des/blocks/where.rb'}, { :when => '/home/des/blocks/when.rb'}, { :bank => '/home/des/blocks/bank.rb'} ] top = [ { :where => '/home/top/blocks/where.rb'}, { :when => '/home/top/blocks/when.rb'}, { :bank => '/home/top/blocks/bank.rb'} ] build = {:top => top, :log => log} build.each do |bu| bu.each do |files| puts files end end --------------------- log where/home/des/blocks/where.rb when/home/des/blocks/when.rb bank/home/des/blocks/bank.rb top where/home/top/blocks/where.rb when/home/top/blocks/when.rb bank/home/top/blocks/bank.rb