Don’t Reinvent the Wheel: Use RubyGems
The basic Ruby programming language is powerful. You can code a lot of your ideas with very little typing. Ruby’s built-in classes and objects get you pretty far by providing for most programming needs. Eventually, you’ll want to do something that isn’t part of the built-in library of code, and you’ll start to write your new great function.
Before you do, consider looking for what you need in the Ruby community.
Gem of a gem
RubyGems are reusable libraries of code that typically focus on doing one job well. People from all over the world contribute free and open-source gems to the community. Just search for the code you’re interested in.
Need to do some graphics programming to make a game? You’ll find the Gosu gem. Want to write a web application? Check out Rails. Need to control a robot? You could use Artoo for that.
When you install Ruby on your computer, you get a number of tools that you can use from your terminal program. RubyGems are installed using the gem program. When you know the name of the gem you want, you set it up with gem install my_interesting_gem. If the gem doesn’t work out for you, you can easily uninstall it, too.
Most popular gems come with basic documentation that will help you understand how to use the code. You can usually follow documentation links on RubyGems.org. Documentation links will often bring you to a dedicated website for the gem itself, or at least to the source code of the gem, typically at a site like GitHub. You can then look for a README.md file, which frequently accompanies the gem.
As you improve your coding skills, someday you may invent an object, class, or more complex set of code that you’d like to share. Instructions for building your own gems are easy to find online, and the community of Ruby programmers is happy to answer questions that you may have.
The worldwide Ruby community is built on a large number of people like you who are generous with their time and inventions. Consider sharing your code and/or knowledge when you can!