From: x1 Date: 2006-08-13T11:30:48+09:00 Subject: Re: Simple question regarding hashes As I said in my first example: ----------------------------- Is something like this possible? asdf = {"letters" => |||||some code that returns something|||||} ----------------------------- I'm fully aware of %w. Is most code w/ foo, abc & xyz useful to you? On 8/12/06, Robert Klemme wrote: > x1 wrote: > > Yep.. Thanks alot. This some pretty neat stuff. :-) > > > > hash = { > > "foo" => Proc.new { > > x = [] > > y = [] > > hash = { > > "x" => ["a", "b", "c"].each {|i| x << i}, > > "y" => ["x", "y", "z"].each {|i| y << i} > > } > > }.call > > } > > puts hash['foo']["y"][1] > > puts hash['foo']["x"][1] > > > >> ruby test1.rb > > y > > b > >> Exit code: 0 > > This code looks completely useless to me. You end up with the same hash > whatever you do since there is no parametrization to your code. Where > is the point? Did I miss something? > > Kind regards > > robert > >