AI Features

The “dig” method

Learn what the dig method is and how to use it in Ruby.

Iteration over nested data structure

Let’s look at the following nested data structure:

users = [
    { first: 'John', last: 'Smith', address: { city: 'San Francisco', country: 'US' } },
    { first: 'Pat', last: 'Roberts', address: { country: 'US' } },
    { first: 'Sam',
...