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
- #349
- rubocop/rubocop#8748
tagliala committed Sep 25, 2024
1 parent ac1231e commit c8c11f6
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

**Gem enhancements:**

- Changed internal `require`s to `require_relative` to make code less dependent on the load path [[#350](https://github.com/panorama-ed/memo_wise/pull/350)]

_No breaking changes!_

**Project enhancements:**
4 changes: 2 additions & 2 deletions lib/memo_wise.rb
Original file line number Diff line number Diff line change
@@ -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.
#

0 comments on commit c8c11f6

Please sign in to comment.