From: Matthias Reitinger Date: 2009-07-29T10:25:04+09:00 Subject: Re: dumb question...where is Object#method usage documented Gary Leydon schrieb: > elf wrote: >> I keep seeing this syntax in documentation: Object#method, but in actual >> use sending a message to an object is usually >> >> object = Object.new >> object.method >> >> Is this just to emphasize that method() operates on an instance of >> Object and not the class Object? >> >> Elf > > Where is this documented? I can't find it in any book...and searching > google on Ruby object#method doesn't lead to an explanation of this. You > get reams of hits using object#method syntax but not where it comes > from. The 1st edition of "Programming Ruby"[1] (a.k.a. the "Pickaxe") mentions this notation: > Within the text, Fred#doIt is a reference to an instance method (doIt) of > class Fred, while Fred.new [In some other Ruby documentation, you may > see class methods written as Fred::new. This is perfectly valid Ruby > syntax; we just happen to feel that Fred.new is less distracting to > read.] is a class method, and Fred::EOF is a class constant. The first appearance in the Ruby changelog[2] dates back to 1995, suggesting that Matz himself may have introduced this convention. -Matthias [1]: http://www.rubycentral.com/pickaxe/preface.html [2]: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_0/ChangeLog?revision=2&view=markup