Why is "rb_define_method(rb_cSymbol, ..." needed?


#1

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.


#2

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 :slight_smile: