Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jan 4, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

peterzhu2118 and others added 3 commits January 4, 2026 10:26
Redos commit 544770d which seems to have accidentally been undone in b27d935.
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.
Although the example code comments indicate that it returns `false`,
a non-matching result for `=~` is actually `nil`.

```ruby
Foo.foo.blank? #=> false
"foo".blank?   #=> false
```

https://github.com/ruby/ruby/blob/v4.0.0-preview3/doc/language/box.md?plain=1#L115-L122

This PR replaces `=~` with `match?` so that it returns the expected `false`.
Since this makes the result a boolean, it also aligns with the expected behavior of
a predicate method name like `blank?`.
@pull pull bot locked and limited conversation to collaborators Jan 4, 2026
@pull pull bot added the ⤵️ pull label Jan 4, 2026
@pull pull bot merged commit ca0fece into turkdevops:master Jan 4, 2026
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants