Ruby tap() vs yield_self()

Ruby’s tap and yield_self methods are two powerful tools that can be used to chain method calls and transform data in a functional programming style. In this article, we will discuss how tap and yield_self work, and how they can be used in real-world scenarios.

 · 4 min · 772 words · Bá Tới

Keyword ThreadGroup in Ruby

Managing related threads with Ruby’s ThreadGroup: creating a group, adding threads, listing and joining them, and when grouping threads helps.

 · 5 min · 887 words · Bá Tới

Keyword Queue in Ruby

Using Ruby’s Queue for first-in, first-out data: creating a queue, the core push/pop methods, and how it fits thread-safe producer–consumer code.

 · 6 min · 1140 words · Bá Tới

Keyword Lazy in Ruby

How lazy enumerators work in Ruby: creating them with lazy and Enumerator::Lazy, chaining map/select/take, and when they save memory on large or infinite collections.

 · 4 min · 803 words · Bá Tới

Proc, Lambda, and Block in Ruby

In Ruby, you can invoke, execute, or run Threads, Anonymous functions, Strings, and even methods that have been turned into objects. Let’s delve into the Callable and Runnable nature of Objects in Ruby.

 ·  · 5 min · 903 words · Bá Tới