I was able able solve the problem ...

	def has_key(k)
		self.each { |k|
		k =3D k[0]
		}
		return k
	end

is there any other better/easier solution?

regards,

salai.

On Wed, Jul 8, 2009 at 6:33 PM, salai<sayakyi / gmail.com> wrote:
> Dear all,
>
> Can you help me how can I implement my own "has_key" method for "hash cla=
ss."
>
> class Hash
>
> =A0 =A0 =A0 =A0def my_each_key(&block)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self.each { |key|
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0yield(key[0])
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0end
>
> =A0 =A0 =A0 =A0def my_each_value(&block)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0self.each { |value|
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0yield(value[1])
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> =A0 =A0 =A0 =A0end
>
> =A0 =A0 =A0 =A0def has_key()
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0#todo
> =A0 =A0 =A0 =A0end
>
> end
>
> h =3D {1 =3D> 1.0, 2 =3D> 2.0, 3 =3D> 3.0 }
>
> many thanks in advance,
>
> salai.
>