DEV Community

Augusts Bautra
Augusts Bautra

Posted on

2 2

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

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs