Locked lesson.
About this lesson
How to install and use a third-party gem in your program.
Exercise files
Download this lesson’s exercise file.
Adding Third-party Functionality with Gems.docx60.4 KB
Quick reference
Adding Third-party Functionality with Gems
You can add third party functionality to your programs using gems.
When to use
Don't reinvent the wheel, whenever you can use code that's already been written - you should!
Instructions
Using a gem is a two-step process. Install the gem to your terminal, then reference it in your code.
To install a gem into your terminal:
gem install "gem_name"
To reference the gem in your program:
require "gem_name"
Hints & tips
- Install from the terminal: gem install "gem_name"
- Reference in your code: require "gem_name"
Lesson notes are only available for subscribers.