Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我实际上正在编写自己的 Ruby gem。它尚未打包并正在开发中。
如何获取 Gem 中文件的路径以及如何获取调用 gem 的路径?
要获取 gem 所在的路径:
File.expand_path(File.join(File.dirname(__FILE__), '..'))
从哪里调用 gem:
current_dir = Dir.pwd