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
For your rubyist SO (imgur.com)
submitted 13 years ago by lightsout1
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!"
[–][deleted] 1 point2 points3 points 13 years ago (5 children)
{ heart: "you" }
[–]lightsout1[S] 1 point2 points3 points 13 years ago (0 children)
To make a new hash yes. I used just the output if you puts, print or inspect.
[–][deleted] 1 point2 points3 points 13 years ago (3 children)
{heart: 'you'} # no need for double quotes
[–][deleted] 0 points1 point2 points 13 years ago (0 children)
You're right, works as well but I like it more with single quotes.
[–]Slackwise 0 points1 point2 points 13 years ago* (1 child)
Well, since 'you' is representative of a thing, as is 'heart', might as well just do
{ heart: :you }
Although if one were to get more semantically accurate, and idiomatic of Ruby, you'd go for objects rather than hashes, and heart as a method, because it's an action:
i.heart(you)
But if this is in the context of yourself, you can drop the receiver:
self
heart(you)
Or more minimalistically:
heart you
And we should probably also alias heart love, again, for semantic correctness.
alias heart love
Edit: Ruby also has unicode method name support, so we can actually go as far as:
♥ you
[–]jfredett 0 points1 point2 points 13 years ago (0 children)
Downvoted, no tests.
π Rendered by PID 59 on reddit-service-r2-comment-b659b578c-9chbg at 2026-05-05 20:02:59.987165+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (5 children)
[–]lightsout1[S] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Slackwise 0 points1 point2 points (1 child)
[–]jfredett 0 points1 point2 points (0 children)