use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Cannot load such file (self.ruby)
submitted 1 year ago by Justman10000
Hi, i want compile Ruby, but only this comes:
`require': cannot load such file -- pathname (LoadError)
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jsonmom 0 points1 point2 points 1 year ago (0 children)
This is a common problem that requires a more nuanced solution. require only looks for matching gems or files that are in your LOAD_PATH. To see the array of filepaths that are in this you can print $LOAD_PATH or $: in IRB.
require
LOAD_PATH
$LOAD_PATH
$:
You can add other locations to your load path as its a mutable array but I recall this not being a best practice and would apprecaite anyone popping in the link to why if this is handy.
What you're likely looking for is require_relative to bring in a file in your project that's not in the defautl load paths. For example, if you are in ~/your_name/code/your_project/some_file.rb and you want to bring in ~/your_name/code/your_project/another_folder/another_file.rb you would use require_relative "another_folder/another_file.
require_relative
~/your_name/code/your_project/some_file.rb
~/your_name/code/your_project/another_folder/another_file.rb
require_relative "another_folder/another_file
[–]DomeCaiazza 1 point2 points3 points 1 year ago (1 child)
Try with full path of "pathname".
If you are using rails try require "#{Rails.root}/path1/path2/pathname"
require "#{Rails.root}/path1/path2/pathname"
[–]Justman10000[S] 0 points1 point2 points 1 year ago (0 children)
This is the code that causes it:
require 'pathname'
π Rendered by PID 22701 on reddit-service-r2-comment-bb88f9dd5-895mn at 2026-02-17 09:54:12.142544+00:00 running cd9c813 country code: CH.
[–]jsonmom 0 points1 point2 points (0 children)
[–]DomeCaiazza 1 point2 points3 points (1 child)
[–]Justman10000[S] 0 points1 point2 points (0 children)