Fix missing require 'pathname' in attachment.rb#615
Open
andyw8 wants to merge 1 commit intocrmne:mainfrom
Open
Fix missing require 'pathname' in attachment.rb#615andyw8 wants to merge 1 commit intocrmne:mainfrom
andyw8 wants to merge 1 commit intocrmne:mainfrom
Conversation
The Attachment class uses Pathname on lines 21 and 164 but was missing the require statement. This caused uninitialized constant errors when using RubyLLM in Ruby < 4.0 (Ruby 4.0+ auto-loads Pathname). The test suite didn't catch this because: - Tests run on Ruby 4.0.1 where Pathname auto-loads - lib/ruby_llm/agent.rb requires pathname, making it globally available - No unit tests instantiated Attachment in isolation Added comprehensive unit tests for the Attachment class to prevent similar issues in the future. Fixes crmne#614 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
9c5339c to
bd29392
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Fixes a missing `require 'pathname'` in `lib/ruby_llm/attachment.rb` that caused `uninitialized constant RubyLLM::Attachment::Pathname` errors when using RubyLLM in Ruby < 4.0.
The Attachment class uses `Pathname` on lines 21 and 164 but was missing the explicit require. Ruby 4.0+ auto-loads Pathname, but Ruby 3.x requires it to be explicitly required.
Also adds comprehensive unit tests for the Attachment class to test it in isolation and prevent similar issues.
Type of change
Scope check
Required for new features
N/A - This is a bug fix
Quality check
Note on code quality verification:
AI-generated code
API changes
Closes #614