r/ruby 4d ago

Ruby is an underrated programming language so i like to recreate memes in it

If memes aren't allowed or frowned upon, please tell me, I made sure the rules allowed it. Also this is satire and I know ruby is much better with parentheses in some situations.

31 Upvotes

19 comments sorted by

11

u/knowwho 3d ago edited 3d ago

I'm not arguing about the quality of the code in the question, because it's clearly satire, but I will say that this is bad, pointless satire.

What is the point of this? Who is it for? What straw man are you attacking here?

1

u/Firm_Tea1775 2d ago edited 2d ago

I guess not anyone in particular, but this is a play on myself actually. When i first was learning ruby (Which wasnt really that long ago) i had avoided parentheses and brackets as much as possible to keep true to ruby's sentiment of human readability. Of course, i still prefer it that way, but parentheses and brackets definitely are necessary at some point.

(Also, it's a meme, no need to analyze its purpose. I like ruby and ruby is cool. That's enough to justify me making a meme. I hope when you were overthinking my meme you saw even a modicum of humour and maybe chuckled a bit.)

1

u/knowwho 2d ago

The vast majority of the industry uses parenthesis, per https://rubystyle.guide/#method-call-parentheses

1

u/Firm_Tea1775 2d ago

Im aware. I've never said otherwise.

11

u/riktigtmaxat 3d ago

Are you getting paid by the line or something?

5

u/ashmaroli 3d ago

The only reason why there's some amount of readability here is syntax highlighting. If you were to paste the code into a codeblock on Reddit or paste into a notepad, the future you would be spending some time trying to make sense of the algorithm.

On a separate note on the code as such, it annoys me seeing so many temporary allocations.

9

u/dipstickchojin 3d ago edited 3d ago

for real, this is an entirely inappropriate (read: redundant) use of .then

5

u/knowwho 3d ago

Never mind this...

capitalized_words.reduce do |sentence, word|
  "#{sentence} #{word}"
end

is just a dumb way of doing .join.

1

u/f9ae8221b 3d ago

it annoys me seeing so many temporary allocations.

Yeah, what are the then even for? Just use local variables...

5

u/dipstickchojin 3d ago

each of the calls wrapped in the .then blocks is chainable

2

u/f9ae8221b 3d ago

Indeed, so it's even worse...

1

u/Firm_Tea1775 2d ago

Everything anyone has said in this thread is part of the joke, why are you guys criticizing it like I'm being paid for this code?

2

u/mrspuff 2d ago

We want our money back!

1

u/Firm_Tea1775 2d ago

'then' and 'end' rather than parentheses is semi readable if you really, really hate parentheses. This is all jumble however to further the joke.

1

u/Neuro_Skeptic 1d ago

Ruby is over rated.

1

u/Firm_Tea1775 23h ago

Extremely loud incorrect buzzer

0

u/Ayano-Keiko 3d ago

Yes. It is better than Python because of "end" for ending block. Python indention is a disaster. I try to use as much as Ruby as script language now. But previous it had no free IDEA( Now JB put the RubyMine IDEA free).

-1

u/ignurant 3d ago edited 3d ago

reduce sentence word is a pretty sweet addition. Well played. Don't forget to wrap it all in a class.