2008/5/20 Tim Wolak <tim.wolak / gmail.com>:
> I am getting data from three hashes and am trying to arrange them in
> four columns, however after I print out the first hash there is a new
> line return.  How do you remove the new line?
>
> Thanks in advance,
> Tim
>
>  def format
>    @prevnl.each{ |key, value| puts "#{key}\t #{value}" } + @curnl.each{
> |key, value| puts "#{value}" }
>    @finbal.each{ |key, value| puts "#{key} \t #{value}" }
>  end

This won't work since the return value of Hash#each is the Hash
instance itself.  I do not know the relationships between your hashes
but you need to iterate them in parallel (e.g. by using the super set
of all keys) and print them then.

Having said that you might be better off to use one single Hash only
and store something as value that contains all the values (Struct or
OpenStruct come to mind).  This is also more efficient memory wise
because you need to maintain a single hash table vs. three at the
moment.

Kind regards

robert


-- 
use.inject do |as, often| as.you_can - without end