LoginSignup
8
8

More than 5 years have passed since last update.

require されている gem のインストールパスを取得する

Last updated at Posted at 2013-02-01

ちょっとしたツールを作っていて、ruby の中で今使っている gem のインストールパスを取得する必要に迫られたので、同じことをやっているはずの gem which コマンドの中をのぞいてパクることにしました。

必要なところだけ抜き出すと、こう。

Gem::Specification.find_by_path(<GEM_NAME>).full_gem_path

参考: rubygems/commands/which_command.rb on github

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8