This post originated from an RSS feed registered with Ruby Buzz
by Red Handed.
Original Post: Autorequire is Basically Gone, Everyone
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
I’ve had a handful of e-mail about the Hpricot gem not working. And here’s the code that’s cited:
require 'rubygems'
require_gem 'hpricot'
If you’re on Ruby-Talk or RubyGems-Devel, this has been circulating since late last year, but it’s still a bit of hazy folklore really. The thing is: require_gem doesn’t do what you think it does. At least, now that autorequire is deprecated.
There was a time when autorequire would let you set a script which would be loaded when require_gem gets called. In the case of Hpricots previous, you call require_gem 'hpricot' and then the gem gets loaded and its lib/hpricot.rb as well.