Skip to content

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

Open
dominion525 wants to merge 1 commit intocrmne:mainfrom
dominion525:fix/method-redefined-warning
Open

Fix method redefined warning for log_regexp_timeout= (Ruby 4.0+)#721
dominion525 wants to merge 1 commit intocrmne: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

Remove the attr_accessor-generated setter before redefining it with
the custom setter to prevent the warning.
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.

1 participant