On Wed, Aug 20, 2008 at 12:48 PM, Brian Ross <p.brian.ross / gmail.com> wrote:
>
> this_array.collect do |hash|
>  @map = {}
>  hash.each_pair do |k,v|
>   @map[k.upcase] = v
>  end
> end
>
> but while the @map gives me the scope to see it outside of the block, it
> looks like only the first hash within the array is passed through.

new_array = this_array.collect do |hash|
  map = {}
  hash.each_pair do |k,v|
     map[k.upcase] = v
  end
  map
end

collect collects the return value of the block

martin