From: "David A. Black" Date: 2009-11-21T08:12:17+09:00 Subject: Re: Something like puts Hi -- On Sat, 21 Nov 2009, Walton Hoops wrote: >> -----Original Message----- >> From: Walton Hoops [mailto:walton@vyper.hopto.org] >>> -----Original Message----- >>> From: marnen@marnen.org [mailto:marnen@marnen.org] >>> >>> Right. Which actually puts it in Object. I had forgotten about the >>> syntactic sugar. >>> >> >> Does it? I've heard that before, but this seems to indicate otherwise. > [snip] >> Maybe I'm missing something? >> > > I am. To answer my own foolish question: > > irb(main):021:0> Object.private_methods.sort > =>[#snip# :foobar #snip#] > irb(main):022:0> Mind you: irb(main):010:0> def x; end => nil irb(main):011:0> "some string".private_methods.grep(/^x/) => [:x] It becomes a private instance method of every object, including the class object Object, because it's defined inside Object: irb(main):013:0> Object.private_instance_methods(false).grep(/^x/) => [:x] David -- THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florida Info and registration at http://www.thecompleatrubyist.com -------------------------------------- My new job: http://tinyurl.com/yfpn9hz