FirstDEV blog
  • Home
  • Ruby
  • Ruby On Rails
  • Tips
  • Solutions
  • About
Subscribe

Ruby 3

A collection of 29 posts

Ruby 3

Refinements in Ruby — Scoped Monkey Patching Without the Footguns

Monkey patching in Ruby has a reputation — usually deserved — for causing exactly the kind of spooky action-at-a-distance bugs that make senior engineers twitch. Open a class anywhere in the codebase, add

Rajan Bhattarai Rajan Bhattarai 9 min read
Ruby 3

Object Freezing and Immutability in Ruby — When to Lock Things Down

Mutability is the default in Ruby — most objects can be changed after creation, which is convenient right up until you have a hash shared between two parts of a system and one

Rajan Bhattarai Rajan Bhattarai 11 min read
Ruby 3

Symbol#to_proc and Callable Objects in Ruby — Making Code Do the Talking

Ruby has several ways to represent callable behavior — blocks, procs, lambdas, and method references — and the syntactic sugar that connects them is one of the language’s quieter strengths. The &:symbol shorthand

Rajan Bhattarai Rajan Bhattarai 9 min read
Ruby 3

Enumerator and Lazy Evaluation in Ruby — Processing Large Collections Without Blowing Memory

Most Ruby developers reach for map, select, and each without thinking twice — and for small arrays, that’s totally fine. But the moment you’re working with large datasets, external files, API paginated responses,

Rajan Bhattarai Rajan Bhattarai 12 min read
Ruby 3

Regular Expressions in Ruby — A Practical Guide That Skips the Theory

Regular expressions have a reputation for being write-only code — you craft them with intense focus, they work, and three months later neither you nor anyone else can read them. That reputation is

Rajan Bhattarai Rajan Bhattarai 8 min read
Ruby 3

Exception Handling in Ruby — rescue, ensure, retry, and raise Done Right

Exception handling is one of those topics that feels simple until you hit a subtle bug caused by rescuing too broadly, retrying without a limit, or swallowing errors that should surface. Ruby’s exception

Rajan Bhattarai Rajan Bhattarai 8 min read
Ruby 3

Hash.new With Default Values — Ruby's Underused Shortcut

Most Ruby developers initialize hashes with {} and manually check for missing keys before updating them. It works, but Ruby’s Hash.new offers a more expressive alternative: hashes that return a default value for

Rajan Bhattarai Rajan Bhattarai 8 min read
Ruby 3

each_with_object vs reduce — Choosing the Right Ruby Aggregator

Ruby gives you multiple ways to aggregate a collection into a single result: reduce (aliased as inject), each_with_object, and occasionally tally, sum, or group_by for specific cases. Developers tend to reach for reduce

Rajan Bhattarai Rajan Bhattarai 9 min read
Ruby 3

include, extend, and prepend — Ruby's Three Ways to Use Modules

Ruby modules are one of the language’s most flexible tools — they handle namespacing, mixins, and code sharing without the rigidity of inheritance. But include, extend, and prepend are three different operations that

Rajan Bhattarai Rajan Bhattarai 8 min read
« Newer Posts Page 2 of 4 Older Posts »
FirstDEV blog © 2026
Proudly published with Jekyll & using Jasper2
Latest Posts Twitter
FirstDEV blog

Check viewARU - Brand Newsletter!

Newsletter to DEVs by DEVs - boost your Personal Brand & career! 🚀