From: James Edward Gray II Date: 2005-10-12T23:11:14+09:00 Subject: Re: Hash as a class variable On Oct 12, 2005, at 9:06 AM, OliverMarchand wrote: > Hi ruby fans, Hello. > I am a python2ruby switcher and just encountered this problem today > with a class variable: > > --- > class Testclass > @@myhash = Hash.new({"a"=>"aaaah"}) In this line, you create a Hash and set the default value for new keys to another Hash. I believe you meant simply: @@myhash = {"a" => "aaaah"} > def initialize() > p @@myhash > end > end > T = Testclass.new > --- Welcome to Ruby! James Edward Gray II