« Return to Thread: own method has_key for class Hash. -howto

Re: own method has_key for class Hash. -howto

by Glenn Jackman-2 :: Rate this Message:

Reply to Author | View in Thread

At 2009-07-08 12:33PM, "salai" wrote:
>  Dear all,
>  
>  Can you help me how can I implement my own "has_key" method for "hash class."
>  
>  class Hash
>   def my_each_key(&block)
[...]
>   def my_each_value(&block)
[...]
>   def my_has_key?(key)

          keys.include?(key)

>   end

--
Glenn Jackman
    Write a wise saying and your name will live forever. -- Anonymous

 « Return to Thread: own method has_key for class Hash. -howto