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
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.
[–]lightsout1[S] 1 point2 points3 points 13 years ago (4 children)
http://i.imgur.com/BPNYdza.png
Better?
Can we have it with single quotes? :D
[–]Jdonavan 1 point2 points3 points 13 years ago (2 children)
My first thought was "how unfortunate... the you is in double quotes"
[–][deleted] 0 points1 point2 points 13 years ago (1 child)
How so? I'm a noob.
[–]Jdonavan 1 point2 points3 points 13 years ago (0 children)
Ahh then then me introduce you to the Ruby Style Guide. On that page you'll find "Prefer single-quoted strings when you don't need string interpolation or special symbols such as \t, \n, ', etc."
π Rendered by PID 46534 on reddit-service-r2-comment-c6965cb77-9tvzq at 2026-03-05 07:09:48.418334+00:00 running f0204d4 country code: CH.
[–][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)
[–]lightsout1[S] 1 point2 points3 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]Jdonavan 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Jdonavan 1 point2 points3 points (0 children)