Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#method_list(obj) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/explainification.rb', line 16

def method_list obj

  "singleton methods:\n".tap do |s|
    obj.singleton_methods.each do |sm|
      m = obj.method(sm)
      s << "  %40s : %40s : %16s\n" % [sm, m.source_location, m.owner]
    end
    klass = obj.class
    [klass].concat(klass.included_modules).each do |imodule|
      s << "#{imodule}:\n"
      imodule.instance_methods(false).each do |imethod|
        m = obj.method imethod
        s << "  %40s : %40s : %16s\n" % [ imethod, m.source_location, m.owner]
      end
    end
  end
end