From: George Date: 2007-11-12T16:33:37+09:00 Subject: Re: Getting methods defined in the top scope On Nov 12, 2007 4:53 PM, Thilina Buddhika wrote: > > but i want to get only the methods defined by my self. Is there any way > to solve this ? This gives the same result as the others, but avoids hardcoding method names: $ cat toplevel_methods.rb TOPLEVEL_METHODS = [] def Object.method_added(name) TOPLEVEL_METHODS << name if private_method_defined?(name) end def toplevel end class Object def not_toplevel end private def fake_toplevel end end p TOPLEVEL_METHODS $ ruby toplevel_methods.rb [:toplevel, :fake_toplevel]