2011/2/11 Frederick Cheung <[email protected]>:
>
>
> On Feb 11, 9:09 pm, Norbert Melzer <[email protected]> wrote:

>> Why is keys empty?
>>
> because you've never actually done x["test"]= ...
> (all you're doing is modifying the hash's default value)

OK, now I tried the following

      b = Hash.new(Array.new)
      h = XmlSimple.xml_in self.raw

      h["data"][0]["bank"][0]["item"].each do |item|
        if b.key? item["cat"]
          b[item["cat"]] = item
        else
          b[item["cat"]] << item
        end
      end

      pp b.keys

but b.keys is still empty...

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to