Ruby equivalent of Python's “dir”?

后端 未结 9 1555
温柔的废话
温柔的废话 2020-12-23 16:09

In Python we can \"dir\" a module, like this:

>>> import re
>>> dir(re)

And it lists all functions in the module. Is ther

9条回答
  •  囚心锁ツ
    2020-12-23 16:50

    I'd go for something like this:

    y String.methods.sort
    

    Which will give you a yaml representation of the sorted array of methods. Note that this can be used to list the methods of both classes and objects.

提交回复
热议问题