Skip to content

Use require_relative in the Lrama codebase - #419

Merged
ydah merged 1 commit into
ruby:masterfrom
koic:use_require_relative
May 17, 2024
Merged

Use require_relative in the Lrama codebase#419
ydah merged 1 commit into
ruby:masterfrom
koic:use_require_relative

Conversation

@koic

@koic koic commented May 12, 2024

Copy link
Copy Markdown
Contributor

If there are many searches in the $LOAD_PATH in the user environment, require will perform unnecessary searches that are not needed. In contrast, require_relative is efficient because it uses a relative path.

Lrama requires Ruby 2.5+, it is possible to use require_relative, which was introduced in Ruby 1.9.
https://github.com/ruby/lrama/blob/v0.6.9/lrama.gemspec#L14

If there are many searches in the `$LOAD_PATH` in the user environment,
require will perform unnecessary searches that are not needed.
In contrast, `require_relative` is efficient because it uses a relative path.

Lrama requires Ruby 2.5+, it is possible to use `require_relative`,
which was introduced in Ruby 1.9.
https://github.com/ruby/lrama/blob/v0.6.9/lrama.gemspec#L14

@ydah ydah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ydah
ydah merged commit c3e37e8 into ruby:master May 17, 2024
@koic
koic deleted the use_require_relative branch May 17, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants