Ruby Gems got me confused
Posted by tom February 23rd, 2007
Recently (well okay maybe not so recently?) there were quite a bit of changes to RubyGems, one of which is that require_gem is deprecated. Previously I could say:
require 'rubygems'
require_gem 'mygem'
This would automagically require ‘mygem’ because of spec.autorequire. There’s also:
require 'rubygems'
gem 'mygem', '>=0.0.8'
This doesn’t do a require ‘mygem’ but I’m able to indicate a version which should be used. Then, which by now should be the standard (if I read everything correct):
require 'rubygems'
require 'mygem'
But where’s the version in that? Maybe this would be an even better solution:
require 'rubygems'
require 'mygem', '>=0.0.8'
But this doesn’t work: ArgumentError: wrong number of arguments (2 for 1). The question is: What is the solution? What should I use and what shouldn’t I use?

Leave a Reply