Forum: Ruby Why is "rb_define_method(rb_cSymbol, ..." needed?

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.
Iñaki Baz C. (Guest)
on 2009-04-03 22:49
(Received via mailing list)
Hi, I'm inspecting the C code of String#capitalize method and have found
the
following:

  rb_define_method(rb_cSymbol, "capitalize", sym_capitalize, 0);

What is it need for? I didn't add such line to my custom C method and
works
ok.
Iñaki Baz C. (Guest)
on 2009-04-03 22:51
(Received via mailing list)
El Viernes 03 Abril 2009, Iñaki Baz C. escribió:
> Hi, I'm inspecting the C code of String#capitalize method and have found
> the following:
>
>   rb_define_method(rb_cSymbol, "capitalize", sym_capitalize, 0);
>
> What is it need for? I didn't add such line to my custom C method and works
> ok.

Ops, understood!

It added "capitalize" method also to Symbols :)
This topic is locked and can not be replied to.