Kris Thomsen wrote:
> I've got a little problem.
> 
> http://pastie.org/447561
> 
> I want the parseFile-method to do what the outcommented-method do - just
> shorter and prettier.
> Anyone who can give some tips on how I can do this?

You have no clear return value, so I don't know exactly how you want 
those arrays returned.  I went ahead and put them in a Hash and returned 
that.

def parseFile file
  data= { 'code' => [], 'desc' => [], 'rate' => [] }
  file.search('currency').each do |currency|
    data.each_pair { |k,a| a.push currency.attributes[k] }
  end
  return data
end
-- 
Posted via http://www.ruby-forum.com/.