... without including all of the public methods of the generic Object? I mean, other than doing array subtraction. I just want to quickly review what's available to me from an object sometimes without going to the docs.
相关问题
- C# how to invoke a field initializer using reflect
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- Are GetCallingAssembly() and GetExecutingAssembly(
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
I started to try to document all these inspection methods at one point in https://github.com/bf4/Notes/blob/master/code/ruby_inspection.rb
As noted in other answers:
Firstly, I like to sort the methods
Useful tip Grep to find out what your options are
Also see https://stackoverflow.com/questions/123494/whats-your-favourite-irb-trick
If there were, it wouldn't be terribly useful: often, the public methods are not your only options, due to Ruby's ability to fake methods by dynamic metaprogramming. So you can't really rely on
instance_methods
to tell you much that's useful.Is this the result you were looking for?
ps I expect this was not the result you were after:
methods
,instance_methods
,public_methods
,private_methods
andprotected_methods
all accept a boolean parameter to determine if the methods of your object's parents are included.For example:
As noted by @Marnen, the methods defined dynamically (eg. with
method_missing
) won't appear here. Your only bet for these ones is hoping that the libraries you're using are well documented.