What Ruby Concept Took You the Longest to Understand?

What Ruby Concept Took You the Longest to Understand? Blocks? Metaprogramming? Enumerators Object model?

Blocks were hard to understand for me.

yield by a wide margin :laughing:

1 Like

blocks, lambdas, yield and procs are def very tricky ones.

A concept I’ve been struggling with is pattern matching! It’s still find it hard to get a good grasp on when and how to use them in the wild. Does anyone have experience using them? Is there a resource you would recommend?

1 Like

Pattern matching for me too. Part of the difficulty is that pattern matching is so rarely used even now a few years after it was released.

3 Likes

This was ages ago so going on flakey memory, but I feel like it was the whole include vs extend, and definitely blocks as well.

3 Likes

The whole life cycle of class level DSLs, when code is ran and how things are stored. When you start with Rails it’s everywhere and you don’t really need to know how it works under the hood. It’s so elegant and sometimes still feels like magic.

2 Likes
  • include, extend, and the class << self idiom
  • Class-level instance variables gotchas, and access specifiers (public/private) “surprises”, mainly due to prior exposure to other languages’ OOP model (like Java)

And not a concept per se, but I keep messing the order of arguments in reduce with a block when not using code-assistance :slight_smile:

1 Like