diff options
| author | Koichi ITO <koic.ito@gmail.com> | 2025-12-21 23:14:22 +0900 |
|---|---|---|
| committer | Satoshi Tagomori <tagomoris@gmail.com> | 2026-01-04 12:52:40 +0900 |
| commit | d8d41d7441aabae5e5948f89cd759bbdc3bf5532 (patch) | |
| tree | ca5f6892c13e85f3b61fe8913cac8be0d3ae07fc /spec/ruby/core/array | |
| parent | 5064af7ed120b1d14ad5020ea39a4a6ff2a4a4ec (diff) | |
[DOC] Use `Ruby::Box#require_relative` in box.md examples
Based on the example, it appears that `foo.rb` and `main.rb` are expected to be in the same directory.
Since Ruby 1.9, the current directory is not included in `$LOAD_PATH` by default.
As a result, running `box.require('foo')` as shown in the sample code raises a `LoadError`:
```console
main.rb:2:in `Ruby::Box#require': cannot load such file -- foo (LoadError)
from main.rb:2:in `<main>'
```
To avoid this, it seems simplest to show either `box.require('./foo')` or `box.require_relative('foo')`.
In this PR, `box.require('foo')` is replaced with `box.require_relative('foo')` to make the intention of
using a relative path explicit.
This should reduce the chance that users trying Ruby Box will run into an unexpected error.
Diffstat (limited to 'spec/ruby/core/array')
0 files changed, 0 insertions, 0 deletions
