Define a .root method for your gems

Augusts Bautra - Jun 9 '22 - - Dev Community
# 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
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .