Arlen Cuss
11/9/2007 10:49:00 AM
Hi,
On Fri, 2007-11-09 at 04:59 +0900, Peter Hug wrote:
> Axel Etzold wrote:
> > require "rubygems"
> > require "json"
>
> Spot on Axel, that fixed it! Thanks heaps.
>
> What puzzles me though is that the same setup works fine under Windows
> (i.e. my ruby scripts can use any installed gems without having to load
> rubygems first.
>
> Any idea why that would be?
Your Windows installation probably automagically includes the gem path
in Ruby's search path (perhaps the installation you have includes some
gems, and so puts that in for you).
Try this:
irb(main):001:0> $:
=> ["/usr/local/lib/site_ruby/1.8",
"/usr/local/lib/site_ruby/1.8/x86_64-linux", "/usr/local/lib/site_ruby",
"/usr/lib/ruby/1.8", "/usr/lib/ruby/1.8/x86_64-linux", "."]
irb(main):002:0>
You can see what paths are included in the search. You should always
require 'rubygems' before requiring anything you expect may be in a gem,
though, for maximum cross-compatibility.
> Pete
Cheers,
Arlen