From: Jimi Damon Date: 2007-12-08T07:42:12+09:00 Subject: Problem with Hash of Arrays I am new to Ruby , but I consider this feature to be a bug. What is happening is that i am creating a new Hash of Arrays. The following code works fine a = Hash.new(Array.new()) a[:first] += ["this"] a[:first] += ["is a"] a[:first] += ["string"] puts a.to_yaml The following also works... a = Hash.new(Array.new()) a[:key] += ["first"] a[:key].push("second") a[:key].push("third") puts a.to_yaml But this does not a = Hash.new(Array.new()) a[:key].push("first") a[:key].push("second") a[:key].push("third") However, this does not work if you don't use the "+=" operator first. Note, this "feature" also occurs for the "<<" operator , or any other methods that expect that a[:key] is already a defined array. I think if you already specified what the new object is going to be , then you should be able to call a method of that object. -- Posted via http://www.ruby-forum.com/.