William James
12/26/2006 7:38:00 PM
Trans wrote:
> thanks Ara and Jon,
>
> I see what your saying. I was using #== not #eql? in comparing the
> keys. So I see why it's faling now. How do I get aorund this? I'm
> caching object based on therr initialization paramaters, which has to
> be an array. Is there a simpler way or do I have to do something like:
>
> class Parameters < Array
> alias :eql? :==
> end
>
> T.
How about association lists?
irb(main):029:0> a1=[[:strip,false]]
=> [[:strip, false]]
irb(main):030:0> a2=[[:strip,false]]
=> [[:strip, false]]
irb(main):031:0> h={}
=> {}
irb(main):032:0> h[a1] = 'foo'
=> "foo"
irb(main):033:0> h[a2] = 'bar'
=> "bar"
irb(main):034:0> h
=> {[[:strip, false]]=>"bar"}