Cookbooks

Practical recipes for real-world Ruby programming tasks.

How to build a frequency tally from an array

Count repeated values in Ruby with each_with_object and a hash that defaults to zero.

ruby arrays hash enumeration

How to Work with Hashes in Ruby

Practical Ruby hash recipes: default values, merging, iteration, and transformation

ruby hash cookbook

How to Work with Files in Ruby

Practical Ruby recipes for reading, writing, and manipulating files

ruby file io cookbook

How to Work with Dates and Times in Ruby

Learn how to work with dates and times in Ruby with practical examples for common tasks

ruby datetime time date cookbook