We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 69b556c commit 6bbae68Copy full SHA for 6bbae68
1 file changed
lib/irb/command/ls.rb
@@ -56,10 +56,10 @@ def execute(arg)
56
o = Output.new(grep: grep)
57
58
klass = Kernel.instance_method(:class).bind(obj).call
59
- is_class_or_module = klass == Class || klass == Module
60
- klass = is_class_or_module ? obj : klass
+ obj_is_module = Kernel.instance_method(:is_a?).bind(obj).call(Module) # Class is also a Module
+ klass = obj_is_module ? obj : klass
61
62
- o.dump("constants", obj.constants) if is_class_or_module
+ o.dump("constants", obj.constants) if obj_is_module
63
dump_methods(o, klass, obj)
64
o.dump("instance variables", Kernel.instance_method(:instance_variables).bind(obj).call)
65
o.dump("class variables", klass.class_variables)
0 commit comments