Loading ruby packages outside rails Mac OS X
I've recently downloaded a ruby extension (Nokogiri) 开发者_StackOverflow中文版using the gem install
command and I would like to use it outside rails, in a small script I'm writing. When I use it in rails, it works perfectly, but how to load it outside rails? Which files should I need to 'require'? (I don't seem to find the downloaded source)
Thank you if you can help me.
See this guide for using nokogiri.
Basically you just do
require 'rubygems'
require 'nokogiri'
and you're set up.
There's also some useful general information on using gems in ruby code here.
精彩评论