Class: AIRefactor::Refactors::Ruby::WriteRuby
- Inherits:
-
Custom
- Object
- BaseRefactor
- Custom
- AIRefactor::Refactors::Ruby::WriteRuby
- Defined in:
- lib/ai_refactor/refactors/ruby/write_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
Constructor Details
This class inherits a constructor from AIRefactor::Refactors::BaseRefactor
Class Method Details
.description ⇒ Object
27 28 29 |
# File 'lib/ai_refactor/refactors/ruby/write_ruby.rb', line 27 def self.description "User supplied prompt to write Ruby code" end |
.takes_input_files? ⇒ Boolean
23 24 25 |
# File 'lib/ai_refactor/refactors/ruby/write_ruby.rb', line 23 def self.takes_input_files? false 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/write_ruby.rb', line 7 def run logger.verbose "Write some ruby code... (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 |