class IRB::ExtendCommand::Ls
def dump_methods(o, klass, obj)
def dump_methods(o, klass, obj) singleton_class = begin obj.singleton_class; rescue TypeError; nil end dumped_mods = Array.new ancestors = klass.ancestors ancestors = ancestors.reject { |c| c >= Object } if klass < Object singleton_ancestors = (singleton_class&.ancestors || []).reject { |c| c >= Class } # singleton_class' ancestors should be at the front maps = class_method_map(singleton_ancestors, dumped_mods) + class_method_map(ancestors, dumped_mods) maps.each do |mod, methods| name = mod == singleton_class ? "#{klass}.methods" : "#{mod}#methods" o.dump(name, methods) end end