Class: AIRefactor::Refactors::Ruby::RefactorRuby
- Inherits:
-
Custom
- Object
- BaseRefactor
- Custom
- AIRefactor::Refactors::Ruby::RefactorRuby
- Defined in:
- lib/ai_refactor/refactors/ruby/refactor_ruby.rb
Instance Attribute Summary
Attributes inherited from BaseRefactor
#ai_client, #failed_message, #input_content, #input_file, #logger, #options
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseRefactor
command_line_options, inherited, #initialize, refactor_name, takes_input_files?
Constructor Details
This class inherits a constructor from AIRefactor::Refactors::BaseRefactor
Class Method Details
.description ⇒ Object
23 24 25 |
# File 'lib/ai_refactor/refactors/ruby/refactor_ruby.rb', line 23 def self.description "Generic refactor using user supplied prompt (assumes Ruby code generation)" end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ai_refactor/refactors/ruby/refactor_ruby.rb', line 7 def run logger.verbose "Custom refactor to #{input_file}... (using user supplied prompt #{prompt_file_path})" logger.verbose "Write output to #{output_file_path}..." if output_file_path begin output_content = process!(strip_ticks: true) rescue => e logger.error "Failed to process #{input_file}: #{e.}" return false end return false unless output_content output_file_path ? true : output_content end |