且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ruby 相当于 Python 的“dir"?

更新时间:2022-10-15 20:43:56

据我所知不是很清楚,但你可以用

object.methods.sort

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

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

And it lists all functions in the module. Is there a similar way to do this in Ruby?

As far as I know not exactly but you get somewhere with

object.methods.sort