the_prole the_prole - 7 months ago 27
Ruby Question

`String.methods - Object.methods` does not show all String class methods

I have run the following command in

from Window's command console

String.methods - Object.methods

But I only get the following output

=> [:try_convert]

How can I show all methods of String Class?


You have somewhat misleading title, because if you want to get a list of

String class methods

then you are actually on the right track, because Object#methods returns a list of singleton methods.

But the documentation you have linked contains a list of instance methods, defined in String class.

To get this list, you want to use Module#instance_methods: