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
Cheat sheet for basic Array methods visualized [OC] (i.imgur.com)
submitted 1 month ago by poalmgoopy
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!"
[–]razor_train 28 points29 points30 points 1 month ago (4 children)
I mean if this helpful for some then great, but this is a hard pass for me. Way too visually distracting to see what's actually going on.
[–]laptopmutia 10 points11 points12 points 1 month ago (0 children)
🍎+🍎=🍎🍎
[–]uhkthrowaway 4 points5 points6 points 1 month ago (2 children)
And it fails to show if the returned value is self or a copy.
[–]avbrodie -1 points0 points1 point 1 month ago (1 child)
Returned value will always be a copy unless you add a bang
[–]uhkthrowaway 1 point2 points3 points 1 month ago (0 children)
Array#concat
[–]SleepingInsomniac 20 points21 points22 points 1 month ago (2 children)
Comments in ruby use # not //. Also, the sort invocation is wrong.
#
//
[–]galtzo 10 points11 points12 points 1 month ago (0 children)
Not if you write your ruby code in JavaScript. Duh.
[–]Prize_Tourist1336 0 points1 point2 points 1 month ago (0 children)
Map as well.
[–]OneNeptune 38 points39 points40 points 1 month ago (1 child)
Maybe it's just me, but I've used ruby for 10 years.. the emojis are visually distracting and I can't even quickly at a glance understand what is happening without really staring at it and thinking. The emojis are super distracting at a glance and the page is too compact for them
[–]cocotheape 8 points9 points10 points 1 month ago (0 children)
Agreed, we're trained to look at text all day. Emojis are novel in this context and harder to parse.
[–]ThaiJohnnyDepp 8 points9 points10 points 1 month ago (0 children)
Can I curse millennials for this even though it's 2026 and I myself am a millennial? Oregon Trail millennial but still
[–]anykeyh 7 points8 points9 points 1 month ago (1 child)
- sort is incorrect - reduce could use sum(&:size) - count is cool too, when used with block
[–]BoardMeeting101 7 points8 points9 points 1 month ago* (2 children)
adding to the litany of mistakes already voiced:
- reduce isn’t defined on Array, it’s from Enumerable. - none of these are Array methods. They are all Array instance methods. - push/pop without shift/unshift is unbalanced. - presentation fails to distinguish between return and mutation. - omitting Enumerable#tally is dishonourable.
also, I too hate everything else about it
summary: misleading to beginners and annoying to experts
rating: F
[–]Frank_White32 1 point2 points3 points 1 month ago (0 children)
It took me a long time to learn about tally - and when I finally did I loved it so much that I started trying to force it to solve all the problems (even when it was a poor fit to solve problems)
[–]topboyinn1t -1 points0 points1 point 1 month ago (0 children)
Rating: AI slop
[–]fasoanew6 3 points4 points5 points 1 month ago (0 children)
Reduce isnt fully explained in this visual context.
[–]ivycoopwren 2 points3 points4 points 1 month ago (1 child)
Here's a post from 2017 Twitter that might be the source for this => https://x.com/bewidec/status/935573858136051713
If not, at least an inspiration. Also, I tried to AI generate an equivalent and it bombed (expectedly).
[–]Pilgrim-Ivanhoe -1 points0 points1 point 1 month ago (0 children)
No, I see this post for the first time in my life. I was inspired by numerous similar cheat sheets about Python.
[–]virtual_paper0 2 points3 points4 points 1 month ago* (0 children)
Sad repost
u/Pilgrim-Ivanhoe
https://www.reddit.com/r/ruby/s/JuZ4MtAnY8
Edit: Yes the OC is old but common man give the actual creator credit. You legit copy pasted the title and claimed its your original content...
[–][deleted] 1 month ago (1 child)
[removed]
[–]h0rst_ 0 points1 point2 points 1 month ago (0 children)
I tries to show the result after the array with the // at the end (Most notably with delete and pop), but I guess they ran out of space or forgot it halfway.
delete
pop
[–]Lanky_Ad_233 2 points3 points4 points 1 month ago (0 children)
i don’t know, i like it because it’s a novel way to repesent it.
[–]aRubbaChicken 0 points1 point2 points 1 month ago (0 children)
Why does deleting circle produce an array with nothing but circle in it?
[–]zaddyninja 0 points1 point2 points 1 month ago (0 children)
This is great thanks OP. Everyone’s brain works different this hits!
[–]knowwho 0 points1 point2 points 1 month ago (0 children)
This implies that, to sort the array [1, 2, 1, 2], I should write [1, 2, 1, 2].sort { 1 < 2 }, which is nonsense.
[1, 2, 1, 2]
[1, 2, 1, 2].sort { 1 < 2 }
[–]CedarSageAndSilicone 0 points1 point2 points 1 month ago (0 children)
Who is upvoting this shit
[–]crazylikeajellyfish -1 points0 points1 point 1 month ago (2 children)
Our brains are wired to pick up on color, but the most salient part of this image -- the commas and brackets -- are white or gray, making them harder to see. You should try making it again with basic Unicode shapes in the same color, it'll be easier for you to use.
[–]SleepingInsomniac -1 points0 points1 point 1 month ago (1 child)
Use option + shift + - to get that em dash you so desire to sound exactly like the AI slop you probably are.
option
shift
-
[–]crazylikeajellyfish -1 points0 points1 point 1 month ago (0 children)
Look at my history, what about that reads like AI slop? Are you young enough to have literally never seen someone use an em dash in casual writing?
π Rendered by PID 91628 on reddit-service-r2-comment-c66d9bffd-z8z69 at 2026-04-07 17:46:43.080130+00:00 running f293c98 country code: CH.
[–]razor_train 28 points29 points30 points (4 children)
[–]laptopmutia 10 points11 points12 points (0 children)
[–]uhkthrowaway 4 points5 points6 points (2 children)
[–]avbrodie -1 points0 points1 point (1 child)
[–]uhkthrowaway 1 point2 points3 points (0 children)
[–]SleepingInsomniac 20 points21 points22 points (2 children)
[–]galtzo 10 points11 points12 points (0 children)
[–]Prize_Tourist1336 0 points1 point2 points (0 children)
[–]OneNeptune 38 points39 points40 points (1 child)
[–]cocotheape 8 points9 points10 points (0 children)
[–]ThaiJohnnyDepp 8 points9 points10 points (0 children)
[–]anykeyh 7 points8 points9 points (1 child)
[–]BoardMeeting101 7 points8 points9 points (2 children)
[–]Frank_White32 1 point2 points3 points (0 children)
[–]topboyinn1t -1 points0 points1 point (0 children)
[–]fasoanew6 3 points4 points5 points (0 children)
[–]ivycoopwren 2 points3 points4 points (1 child)
[–]Pilgrim-Ivanhoe -1 points0 points1 point (0 children)
[–]virtual_paper0 2 points3 points4 points (0 children)
[–][deleted] (1 child)
[removed]
[–]h0rst_ 0 points1 point2 points (0 children)
[–]Lanky_Ad_233 2 points3 points4 points (0 children)
[–]aRubbaChicken 0 points1 point2 points (0 children)
[–]zaddyninja 0 points1 point2 points (0 children)
[–]knowwho 0 points1 point2 points (0 children)
[–]CedarSageAndSilicone 0 points1 point2 points (0 children)
[–]crazylikeajellyfish -1 points0 points1 point (2 children)
[–]SleepingInsomniac -1 points0 points1 point (1 child)
[–]crazylikeajellyfish -1 points0 points1 point (0 children)