Class: RailsAiBridge::Tools::SearchCode::RipgrepSearch
- Inherits:
-
Object
- Object
- RailsAiBridge::Tools::SearchCode::RipgrepSearch
- Defined in:
- lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb
Overview
Executes codebase searches using ripgrep.
Defined Under Namespace
Classes: CommandBuilder
Instance Method Summary collapse
-
#call ⇒ Array<Hash>
Executes the ripgrep search and parses results.
-
#initialize(params) ⇒ RipgrepSearch
constructor
A new instance of RipgrepSearch.
Constructor Details
#initialize(params) ⇒ RipgrepSearch
Returns a new instance of RipgrepSearch.
11 12 13 14 |
# File 'lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb', line 11 def initialize(params) @params = params @root = params[:root] end |
Instance Method Details
#call ⇒ Array<Hash>
Executes the ripgrep search and parses results.
19 20 21 22 23 24 25 |
# File 'lib/rails_ai_bridge/tools/search_code/ripgrep_search.rb', line 19 def call cmd = CommandBuilder.new(@params).build output, _status = Open3.capture2(*cmd, err: File::NULL) parse_output(output) rescue StandardError => error [{ file: 'error', line_number: 0, content: error. }] end |