Iñaki Baz Castillo
2/19/2009 9:31:00 PM
El Jueves, 19 de Febrero de 2009, Rick DeNatale escribi=C3=B3:
> class InsensitiveHash
> =C2=A0 =C2=A0 def initialize
> =C2=A0 =C2=A0 =C2=A0 =C2=A0@hash =3D {}
> =C2=A0 =C2=A0 end
>
> =C2=A0 =C2=A0def [](key}
> =C2=A0 =C2=A0 =C2=A0 @hash[key.downcase]
> =C2=A0 =C2=A0end
>
> =C2=A0 =C2=A0def []=3D(key, value)
> =C2=A0 =C2=A0 =C2=A0 @hash[key.downcase] =3D value
> =C2=A0 =C2=A0end
> end
>
> And yes, I'd recommend having the InsensitiveHash have an instance of Hash
> rather than being a subclass of Hash.
The fact is I already have something as above, but I wonder if using a new=
=20
Ruby C native class would be *really* faster.
Thanks a lot.
=2D-=20
I=C3=B1aki Baz Castillo