From: "Iñaki Baz Castillo" Date: 2009-12-21T20:50:34+09:00 Subject: Re: How to get a file contained in a gem "lib" directory? [SOLVED] El Lunes, 21 de Diciembre de 2009, Iñaki Baz Castillo escribió: > Hi, I've build a gem "mylib" which contains a file called "myfile.xml" > under "lib/mylib" dir. Let's imagine that depending on the environment it > is stored (after installed) in: > > /usr/local/lib/ruby1.9/gems/1.9/gems/mylib-1.0.1/lib/mylib/myfile.xml > > But of course there could be different versions of the gem: > > /usr/local/lib/ruby1.9/gems/1.9/gems/mylib-1.0.0/lib/mylib/myfile.xml > /usr/local/lib/ruby1.9/gems/1.9/gems/mylib-1.0.1/lib/mylib/myfile.xml > > Then I write a program which does: > > require "mylib" > > so the latest version (1.0.1) is loaded. > > How would I get "myfile.xml" for the loaded "mylib" gem version? I'm > looking for a Gem class method like "Gem.bin_path(gemname)" but I cannot > find it. Found it: Gem.required_location(gemname,"") -- Iñaki Baz Castillo