Forum: Ruby very lost with rubygems and required files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dirk M. (Guest)
on 2006-04-17 20:57
(Received via mailing list)
hi everyone,
a few hours ago, i successfully packed my first gem.
however, my gem uses certain .png images.
when somebody requires my gem, i want the images to be loaded from <gem
location>/images/
but as the file that is required is located in <gem location>/lib/ , the
images are loaded from ../images/
how can i setup the gem or the required file, so that the files will be
loaded from the proper directory?
greetings, Dirk.
Ross B. (Guest)
on 2006-04-17 21:25
(Received via mailing list)
On Tue, 2006-04-18 at 01:56 +0900, Dirk M. wrote:
> hi everyone,
> a few hours ago, i successfully packed my first gem.
> however, my gem uses certain .png images.
> when somebody requires my gem, i want the images to be loaded from <gem
> location>/images/
> but as the file that is required is located in <gem location>/lib/ , the
> images are loaded from ../images/
> how can i setup the gem or the required file, so that the files will be
> loaded from the proper directory?
> greetings, Dirk.

Could you use something like:

	PNGPATH = File.join(File.dirname(__FILE__), '../images/')

in your main require file?
This topic is locked and can not be replied to.