0

I'm actually writing my own Ruby gem. It is yet not packed and under development.

How can I get the path to the files within the Gem and how can I get the path from where the gem is called from?

Andrew Marshall
  • 89,426
  • 20
  • 208
  • 208
JAkk
  • 1,216
  • 1
  • 10
  • 12
  • thanks andrew for making my use of the english language better :) – JAkk Sep 26 '12 at 11:20
  • For what do you need it? If you need a [way to require a file located in the same directory](http://stackoverflow.com/questions/788550/is-there-a-shorter-way-to-require-a-file-in-the-same-directory-in-ruby/7862107#7862107) then you may find easier ways. – knut Sep 26 '12 at 14:13

1 Answers1

1

To get path where gem is:

File.expand_path(File.join(File.dirname(__FILE__), '..'))

Where gem is called from:

current_dir = Dir.pwd
Hauleth
  • 20,457
  • 4
  • 58
  • 98