Blog

Enumerable: The Module That Runs Ruby

Ruby's Enumerable module gives you 50+ methods for free. Understanding it changes how you think about collections, pipelines, and data transformation.

Hash#fetch vs Hash#[]: The Difference That Catches Bugs

Hash#[] silently returns nil for missing keys. Hash#fetch raises an error. That distinction prevents more bugs than you'd expect.

tap, then, and yield_self: Ruby's Pipeline Methods

Ruby has three methods for building clean data pipelines: tap, then, and yield_self. Each does something slightly different, and knowing which to reach for makes your code more expressive.

Duck Typing: Ruby's Quiet Superpower

Why Ruby's 'if it quacks like a duck' philosophy leads to more flexible, testable, and elegant code.

Metaprogramming: Where the Line Is

Ruby's metaprogramming is its most powerful and most dangerous feature. Here's how experienced teams decide when to use it and when to walk away.

Rails Concerns Done Right

Concerns are controversial in the Rails world. They shouldn't be. The problem isn't the pattern, it's how people use it. Here's how to use concerns well.

Readability Is a Feature: What Ruby Gets Right That Most Languages Don't

Ruby was designed to make programmers happy. That's not a slogan, it's a design philosophy that shaped how the language reads, and why that still matters.

Understanding Ruby's Method Lookup Path

When you call a method in Ruby, there's a specific chain of places Ruby looks to find it. Understanding that chain is the key to debugging 'wrong method called' bugs.

Freeze Your Strings: Ruby's Most Underused Pragma

The frozen_string_literal pragma is one line of code that prevents mutation bugs, improves performance, and signals intent. Here's why you should be using it everywhere.

How Ruby's Testing Culture Changed the Way We Build Software

Ruby didn't just popularize test-driven development, it made testing feel inevitable. Here's how a community obsession became an industry standard.

Writing Rake Tasks That Don't Suck

Most Rake tasks are untested blobs of procedural code. Here's how to write ones that are namespaced, documented, testable, and actually maintainable.

Ruby's Comparable Module in 5 Minutes

Include Comparable, define one method, and get six comparison operators plus sorting for free. It's one of Ruby's best-kept secrets for custom objects.

The 3 ActiveRecord Queries Slowing Down Your Rails App

N+1 queries, unnecessary column loading, and the count/size/length trap. These three patterns silently kill Rails performance, and they're easy to fix.

Pattern Matching Changed How I Write Ruby

Ruby 3's pattern matching with case/in isn't just syntax sugar. It's a fundamentally different way to destructure data, and it's been production-ready since 3.1.

Struct vs OpenStruct: When to Use Which

Ruby gives you two ways to create simple data objects. One is fast, explicit, and production-ready. The other is convenient, flexible, and almost always the wrong choice.

Welcome to RubyHash

Introducing RubyHash, a simple tool to diff your Ruby hashes side by side.

Don't miss a post

Subscribe to get new Ruby and Rails articles delivered straight to your inbox.