From: Christopher Campbell Date: 2006-01-02T03:57:58+09:00 Subject: Re: Tuples/Records/Quicky Objects + Read Only Arrays? Robert Klemme wrote: > Christopher Campbell wrote: >> Thanks guys. >> >> I see now we can use arrays and hashes to get >> >> [{'name' => 'hi', 'c_alias' => 'c_hi'}] >> >> or >> >> [{:name => 'hi', :c_alias => 'c_hi'}] >> >> which works dandy. I think my brain evaporated with the festivities >> last night, heh. > > Are you sure you recovered? I mean, what's the point in stuffing a hash > into a one element array? Heh... it was just an example, I will be stuffing lots of hashes into an array. def test_add_many_aliased sample = [{:name => "abc", :c_alias => "c_abc"}, {:name => "hoop", :c_alias => "c_hoop"}, {:name => "blah", :c_alias => "c_blah"}] elist = EnumList.new("many_aliased") sample.each_index {|e| elist.add_alias(sample[e][:name], sample[e][:c_alias]) assert_equal(sample[e][:name], elist[e].name) assert_equal(sample[e][:c_alias], elist[e].c_alias)} end