Skip to content

Fix method redefined warning for log_regexp_timeout= (Ruby 4.0+)#721

Merged
crmne merged 3 commits into
crmne:mainfrom
dominion525:fix/method-redefined-warning
Jul 3, 2026
Merged

Fix method redefined warning for log_regexp_timeout= (Ruby 4.0+)#721
crmne merged 3 commits into
crmne:mainfrom
dominion525:fix/method-redefined-warning

Conversation

@dominion525

Copy link
Copy Markdown
Contributor

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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
    • All tests pass: bundle exec rspec
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

AI-generated code

  • I used AI tools to help write this code
  • I have reviewed and understand all generated code (required if above is checked)

API changes

  • No API changes

dominion525 and others added 2 commits April 6, 2026 17:52
Remove the attr_accessor-generated setter before redefining it with
the custom setter to prevent the warning.
@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.47%. Comparing base (efbe8fa) to head (736df6f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #721      +/-   ##
==========================================
- Coverage   82.49%   82.47%   -0.03%     
==========================================
  Files         175      175              
  Lines        8171     8172       +1     
  Branches     1376     1376              
==========================================
- Hits         6741     6740       -1     
- Misses        890      891       +1     
- Partials      540      541       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@crmne crmne merged commit 9ee47a1 into crmne:main Jul 3, 2026
21 checks passed
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