n Apr 13, 2007, at 1:30 PM, Paul wrote:

> Hi there.  I know I've done something similar to this before but I
> seem to be stumped at the moment and thought I would ask for help.
>
> I have a temporary Hash array that holds information in different
> elements that need to be combined to produce single line outputs.
> Here's some detail:
>
> tmp_hash =
> [["foo:1", "123"],
>  ["foo:2", "abc"],
>  ["bar:1", "456"],
>  ["bar:2", "xyz"]]
>
> Desired Output:
> ---
> "foo" "123" "abc"
> "bar" "456" "xyz"
> ---

 >> tmp_hash =
?> [["foo:1", "123"],
?>  ["foo:2", "abc"],
?>  ["bar:1", "456"],
?>  ["bar:2", "xyz"]]
=> [["foo:1", "123"], ["foo:2", "abc"], ["bar:1", "456"], ["bar:2",  
"xyz"]]
 >> require "enumerator"
=> true
 >> tmp_hash.each_slice(2) do |alpha, num|
?>   puts [ alpha.first[/^\w+/],
?>          alpha.last,
?>          num.last ].map { |f| %Q{"#{f}"} }.join("\t")
 >> end
"foo"   "123"   "abc"
"bar"   "456"   "xyz"
=> nil

Hope that helps.

James Edward Gray II