Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Created January 11, 2017 14:09
Show Gist options
  • Save sixtyfive/0f1aaed94bb86ddf7177f8fa9b52b842 to your computer and use it in GitHub Desktop.
Save sixtyfive/0f1aaed94bb86ddf7177f8fa9b52b842 to your computer and use it in GitHub Desktop.
problem understanding how to use Pathname
# this be blah/blah.rb
# there also be lib/foobar.rb
require 'pathname'
ROOT = Pathname(__FILE__).dirname.parent
require_relative ROOT + 'lib' + 'foobar'
# the above doesn't work saying:
# blah/blah.rb:7:in `require_relative': cannot load such file -- /home/jrs/Projects/test/blah/lib/foobar.rb (LoadError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment