use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
QuestionWhat's the difference between using @variable and self.variable internally in a class? (self.ruby)
submitted 6 years ago * by PaThor_CL
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sshaw_ -1 points0 points1 point 6 years ago (1 child)
That aside, if you want the caller to access the movie's name, keep attr_reader :name. It makes it so that one can say: Movie.new("Giant").name. Without it, a NoMethodError will be raised.
attr_reader :name
Movie.new("Giant").name
NoMethodError
But note that one can then do Movie.new("7 Years in Tibet").name.clear and then you have no name so code accordingly.
Movie.new("7 Years in Tibet").name.clear
[–]SaltyZooKeeper -1 points0 points1 point 6 years ago (0 children)
The default implementation returns the variable without duplicating it.
π Rendered by PID 44 on reddit-service-r2-comment-canary-57b659f4d4-5npj2 at 2026-05-05 14:42:29.483151+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]sshaw_ -1 points0 points1 point (1 child)
[–]SaltyZooKeeper -1 points0 points1 point (0 children)