Latest Guides
View all →WebSockets in Ruby
Build real-time features in Ruby with three WebSocket approaches: websocket-ruby for pure Ruby, ActionCable for Rails, and async-websocket.
The Command Pattern in Ruby
Implement the command pattern in Ruby — encapsulate requests as objects, enable undo/redo, queue operations, and build extensible CLI apps.
The Builder Pattern in Ruby
Learn how to implement the builder pattern in Ruby for cleaner, step-by-step object construction with fluent interfaces and nested structures.
Ruby Array Methods: The Practical Guide
Learn the 7 Ruby array methods you'll use every day—map, select, reduce, find, sort_by, uniq, and flatten—with practical patterns and real examples.
ActiveSupport Outside of Rails
A practical guide to using ActiveSupport core extensions, time utilities, and number helpers in plain Ruby scripts and gems
Reference
View all →Hash#max_by
Find the key-value pair in a hash with the largest value, or the top N pairs by a criterion you define.
Hash#each_with_object
Iterate over a hash, passing each key-value pair and a memo object into the block. The memo object is accumulated across iterations and returned at the end.
Hash#group_by
Group hash entries by a criteria derived from each key-value pair. Returns a hash where keys are group labels and values are arrays of matching entries.
Hash#min_by
Find the key-value pair in a hash that minimizes the value returned by the block. Returns a two-element array of the key and value.
Hash#fetch
Retrieve a value by key, with explicit error handling when the key is absent. Use fetch to avoid silent nil returns from missing keys.
Hash#fetch
Retrieve a value by key, with explicit error handling when the key is absent. Use fetch to avoid silent nil returns from missing keys.