From: 7stud -- Date: 2007-10-21T13:26:56+09:00 Subject: Re: objects or variables? Thufir wrote: > I'm going by "Why's (poignant) Guide to Ruby": > > starmonkey = ratchet.attach( captive_monkey, captive_star ) > > The ratchet gets an attach message. What needs to be attached? The > method arguments: the captive_monkey and the captive_star. We are > given back a starmonkey, which we have decided to hang on to. > > > > ratchet.attach() is a static method? > He doesn't say, and I don't think that is the point of the example. The example shows you how to call a method. Whether it's a static/class method or a regular method is irrelevant. However, on the previous page there is a clue: ---- Class methods Like the methods described above (also called instance methods), class methods are usually attached after variables and constants. Rather than a dot, a double colon is used. Door::new( :oak ) ---- Since 1) ratchet does not start with a capital letter, and 2) there is no scope resolution operator(::) after ratchet, you can draw your own conclusions. > > ratchet is an object or a static class? > Once again, that's irrelevant to the example. But since ratchet doesn't start with a capital letter... > > starmonkey is an object, yes? > Yes, but everything is an object in ruby, so that doesn't say much about starmonkey. > > Of what class? > The Starfish class. -- Posted via http://www.ruby-forum.com/.