From: Daniel Roux Date: 2009-06-16T01:47:49+09:00 Subject: Re: list methods only for specific class --001485e8d21662c9cb046c65d14d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Mon, Jun 15, 2009 at 10:27 AM, Le Sa wrote: > I would like to list ms1 and ms2, but thanks for the help! > > class Person > def mp1() end > end > > class Student < Person > def ms1() end > def ms2() end > > private :ms2 > end > > Student.public_methods(false).each {|m|puts m} > puts "************\n" > Student.instance_methods(false).each{|m|puts m} > =begin > OUTPUT IS: > > yaml_tag_subclasses? > allocate > to_yaml > superclass > new > ************ > ms1 > =end > -- > Posted via http://www.ruby-forum.com/. > > Try: Student.new.public_methods(false) + Student.new.private_methods(false) => ["ms1", "ms2"] -- Daniel Roux --001485e8d21662c9cb046c65d14d--