Search⌘ K
AI Features

Gems

Explore the concept of Ruby gems as language extensions that add useful features. Learn to install and configure gems like pry and awesome_print to enhance array visualization and debugging, making coding in Ruby clearer and more efficient.

We'll cover the following...

What are gems?

Until now, all of our experiments have been quite straightforward. However, with two-dimensional arrays, we may have noticed the lack of visual cues. For example, the array for the “Sea Battle” game doesn’t look very intuitive in the console:

$ irb
> Array.new(10) { Array.new(10) }
 => [[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil], [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]]
...