Hi all,
I’m running into a weird problem with rubygems and using
‘require_gem’. Given the following code,
– being code –
require ‘rubygems’
require_gem ‘mechanize’, ‘>= 0.6.3’
class MyClass
def initialize
@agent = WWW::Mechanize.new # Line 7
end
end
mc = MyClass.new # Line 12
– end code –
I get this error:
NameError: uninitialized constant MyClass::WWW
method initialize in untitled document at line 7
at top level in untitled document at line 12
Could it be that I’m missing something really obvious? When I replace
the require_gem line with just “require ‘mechanize’”, it works
according to my expectations. I’m using ruby 1.8.4, rubygems 0.9.0
(also tried with 0.8.11) and mechanize is at 0.6.3 as a gem. It
doesn’t seem to matter if the explicit version is there or not, the
same error is produced.
Thanks!
-Pawel