From: "Ara.T.Howard" Date: 2005-10-12T23:31:54+09:00 Subject: Re: Hash as a class variable On Wed, 12 Oct 2005, OliverMarchand wrote: > Hi ruby fans, > > I am a python2ruby switcher and just encountered this problem today > with a class variable: > > --- > class Testclass > @@myhash = Hash.new({"a"=>"aaaah"}) @@myhash = { "a" => "aaaah" } or @@myhash = Hash[ "a" => "aaaah" ] this is what you wrote means: irb:~/eg/ruby > irb irb(main):001:0> h = Hash::new({ 'the default' => 'value' }) => {} irb(main):002:0> h[42] => {"the default"=>"value"} hth. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================