ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Ruby/Tk Primer: Creating a cron GUI Interface with Ruby/Tk
Subject:   self.puts
Date:   2004-06-28 18:06:54
From:   aturley
Response to: Using Ruby

Since nobody else has written anything yet, I'll venture a guess. puts is a private method of the "main" object. You can see this by typing self.private_methods. I'm guessing that by calling puts by itself, the interpreter invokes a special private method handler. On the other hand, if you call self.puts, it acts like any old random object had called it, and says, "Oh no you don't! You can't touch my privates." Even though it's trying to access it's own private method. Steamy, eh?

But I'm still learning about Ruby, so I could be wrong.