From: "Stephan Kämper" Date: 2004-07-21T00:02:13+09:00 Subject: Re: Ruby/Tk article on macdevcenter gabriele renzi wrote: > il 19 Jul 2004 21:37:37 GMT, ptkwt@aracnet.com (Phil Tomson) ha > scritto:: > > >>Hadn't seen this mentioned yet: >> >>http://www.macdevcenter.com/pub/a/mac/2004/06/25/ruby_pt1.html >> > > > this made me notice this: > ruby -e "self.puts 'ciao' " > -e:1: private method `puts' called for main:Object (NoMethodError) > > why this error appears? puts is - as the error message says, a privat method. In Ruby - if memory serves right - private methods can only be called with an implicit receiver. A citation from the pickaxe: "Private methods cannot be called with an explicit receiver. Because you cannot specify an object when using them, private methods can be called only in the defining class and by direct descendents within that same object." Stephan