Forum: Ruby Why Enumerable adds "replace" method?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0f1f17ba297242e9d3c86d4cc0a6ea85?d=identicon&s=25 Iñaki Baz Castillo (Guest)
on 2009-02-23 20:32
(Received via mailing list)
Hi, when including Enumerable module in a class, its instances get
the "replace" method in which I'm not interested. Why this method is
added?
It doesn't appear in Enumerable.

Thanks.
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2009-02-23 20:40
(Received via mailing list)
On Feb 23, 12:30 pm, Iñaki Baz Castillo <i...@aliax.net> wrote:
> Hi, when including Enumerable module in a class, its instances get
> the "replace" method in which I'm not interested. Why this method is added?


It isn't.

Ruby 1.8.6 p114

class Foo
   include Enumerable
end

Foo.instance_methods.include?('replace') => false

Regards,

Dan
0f1f17ba297242e9d3c86d4cc0a6ea85?d=identicon&s=25 Iñaki Baz Castillo (Guest)
on 2009-02-23 20:48
(Received via mailing list)
El Lunes, 23 de Febrero de 2009, Daniel Berger
escribió:>    include Enumerable
> end
>
> Foo.instance_methods.include?('replace') => false

Sorry, my fault. Thanks a lot.
This topic is locked and can not be replied to.