Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
More on the fundamentals...
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="dblack, post: 4499527"] Hi -- There's no method called name. Move the @ from @instance to name and you're set :-) There's no method called phrase. It seems that you're confusing instance variable assignment with method creation. They're unrelated. You can, of course, write a method that returns the current value of an instance variable: def name @name end and you can even get Ruby to do it semi-automatically for you: attr_reader :name # creates the above "name" method But @name = name is just a variable assignment. I would say "instances of the class Greeter". Have another look at the attr_* family of methods, and keep in mind that they're essentially shortcuts for writing your own get-and/or-set methods (using instance variables), and I think that part of it will fall into place. David -- David A. Black [email]dblack@wobblini.net[/email] "Ruby for Rails", from Manning Publications, coming April 2006! [URL]http://www.manning.com/books/black[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
More on the fundamentals...
Top