Tools for exploring Ruby's objects!
require 'introspect/core_ext' # the core extensions are OPTIONAL but handy
my_object.introspectTells you all about the object and the objects inside it.
require 'introspect'
Introspect.introspect my_object, :contentsexample
[1,2,3].introspect :contentsoutput
{
[1, 2, 3]=>
{
:class=>Array,
:ancestors=>
[
Array,
Enumerable,
Object,
PP::ObjectMixin,
Introspect,
Kernel,
BasicObject
]
}
}Tells you which object a method is defined on.
require 'introspect'
Introspect.introspect my_object, :which, :method_nameexample
[1,2,3].introspect :which, :cycleoutput
ArrayBug reports and pull requests are welcome on GitHub at https://github.com/acook/introspection.
© Anthony M. Cook 2012-2016