Jim Lindley Notes

Ruby 1.9: Gems Built In

January 2nd, 2008

If you’ve got Ruby 1.9 installed, you’ve also got the RubyGems package management system installed. It’s been moved into the core distribution, with an eye towards repackaging the standard libraries as gems (but still included by default) to allow for a more manageable development process.

Gems aren’t loaded and don’t take up memory until you require them. You no longer need to require gem itself before asking to load a gem.

>> VERSION
=> "1.8.6"
>> require 'rake'
  LoadError: no such file to load -- rake
>> require 'rubygems'
=> true
>> require 'rake'
=> true

But now with 1.9:

>> RUBY_VERSION
=> "1.9.0"
>> require 'rake'
=> true

Most gems are not updated yet for 1.9 compatibility, check before using any. Gems now are supposed to include a Ruby compatibility identifier. If you come across a gem without one it’s pretty safe to say that it won’t work on 1.9.

Sorry, comments are closed for this article.