--0016e6d58a6fc2f25c04965a1b9c
Content-Type: text/plain; charset=UTF-8

On Wed, Dec 1, 2010 at 8:52 AM, niklas | brueckenschlaeger <
niklas / brueckenschlaeger.de> wrote:

> Consider code like this:
>
>  def do_sth_on(this)
>    if this.kind_of?(Enumerable)
>      this.map {|item| do_sth_on(item) }
>    else
>      # whatever
>    end
>  end
>
> This is a method that either works on a collection or on single item. As
> soon as a you make Object behave like Enumerable, this breaks and leads
> to recursion.
>

Well, sure. The whole point is to write, instead of the above:

def do_sth_on(this)
  this.each do
    #whatever
  end
end

--0016e6d58a6fc2f25c04965a1b9c--