Skip to content

Commit

Permalink
Prefer require_relative for internal requires
Browse files Browse the repository at this point in the history
`require_relative` is preferred over `require` for files within the same
project because it uses paths relative to the current file, making code
more portable and less dependent on the load path.

This change updates internal requires to use `require_relative` for
consistency, performance, and improved portability.

Ref:
- ruby/psych#522
- ruby/logger#20
- ruby/rdoc#658
- panorama-ed#349
- rubocop/rubocop#8748
  • Loading branch information
tagliala committed Sep 19, 2024
1 parent ac1231e commit 40cb797
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/memo_wise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require "set" # Ruby < 3.2 does not load `set` by default.

require "memo_wise/internal_api"
require "memo_wise/version"
require_relative "memo_wise/internal_api"
require_relative "memo_wise/version"

# MemoWise is the wise choice for memoization in Ruby.
#
Expand Down

0 comments on commit 40cb797

Please sign in to comment.