DEV Community

Augusts Bautra
Augusts Bautra

Posted on

Define a .root method for your gems

# my_gem/
#   lib/
#     my_gem.rb

module MyGem
  # @return [Pathname] # similar to Rails.root
  def self.root
    Pathname.new(File.expand_path("..", __dir__))
  end
end
Enter fullscreen mode Exit fullscreen mode

Discussion (0)