Skip to content

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

Open
dominion525 wants to merge 2 commits into
crmne:mainfrom
dominion525:fix/method-redefined-warning
Open

Fix method redefined warning for log_regexp_timeout= (Ruby 4.0+)#721
dominion525 wants to merge 2 commits into
crmne:mainfrom
dominion525:fix/method-redefined-warning

Conversation

@dominion525
Copy link
Copy Markdown

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
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.05%. Comparing base (4942d6c) to head (a1ac217).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #721   +/-   ##
=======================================
  Coverage   87.05%   87.05%           
=======================================
  Files         119      119           
  Lines        5594     5595    +1     
  Branches     1407     1407           
=======================================
+ Hits         4870     4871    +1     
  Misses        724      724           

☔ View full report in Codecov by Sentry.
📢 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.

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