From: Brian Adkins Date: 2007-10-10T08:00:02+09:00 Subject: Re: Indexers and blocks? On Oct 9, 2:35 pm, Gary Wright wrote: > On Oct 9, 2007, at 1:50 PM, Brian Adkins wrote: > > > c = MyClass.new('default') > > c[:foo] = 'foo' > > puts c[:foo] > > puts c[:test] > > c = MyClass.new {|obj,key| "default for #{key}" } > > puts c[:test] > > This looks to me like you've just recreated features > of Hash. Might as well just use Hash. Presumably the OP had a reason for wanting an "array-like class" instead of an actual Array or Hash. I only used a Hash in the example for simplicity.