Commit 9ee47a1
Fix method redefined warning for log_regexp_timeout= (Ruby 4.0+) (#721)
## What this does
On Ruby 4.0+, `require "ruby_llm"` emits:
warning: method redefined; discarding old log_regexp_timeout=
The `option` class method generates a setter via `attr_accessor`, which
is then
overridden by the custom `log_regexp_timeout=` setter. This adds
`remove_method`
before the redefinition to suppress the warning. A regression spec is
included.
## Type of change
- [x] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation
- [ ] Performance improvement
## Scope check
- [x] I read the [Contributing
Guide](https://github.com/crmne/ruby_llm/blob/main/CONTRIBUTING.md)
- [x] This aligns with RubyLLM's focus on **LLM communication**
- [x] This isn't application-specific logic that belongs in user code
- [x] This benefits most users, not just my specific use case
## Quality check
- [x] I ran `overcommit --install` and all hooks pass
- [x] I tested my changes thoroughly
- [x] All tests pass: `bundle exec rspec`
- [ ] I updated documentation if needed
- [x] I didn't modify auto-generated files manually (`models.json`,
`aliases.json`)
## AI-generated code
- [x] I used AI tools to help write this code
- [x] I have reviewed and understand all generated code (required if
above is checked)
## API changes
- [x] No API changes
Co-authored-by: Carmine Paolino <carmine@paolino.me>1 parent efbe8fa commit 9ee47a1
2 files changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
67 | 74 | | |
0 commit comments