Sha256: 23a2b6d598ae1d8d70d6f417d12ceaa8795f8cef7d4b91f4cbf5451c497a8be9

Contents?: true

Size: 807 Bytes

Versions: 6

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

module AIRefactor
  module Refactors
    module Ruby
      class RefactorRuby < Custom
        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.message}"
            return false
          end

          return false unless output_content

          output_file_path ? true : output_content
        end

        def self.description
          "Generic refactor using user supplied prompt (assumes Ruby code generation)"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ai_refactor-0.6.0 lib/ai_refactor/refactors/ruby/refactor_ruby.rb
ai_refactor-0.5.4 lib/ai_refactor/refactors/ruby/refactor_ruby.rb
ai_refactor-0.5.3 lib/ai_refactor/refactors/ruby/refactor_ruby.rb
ai_refactor-0.5.2 lib/ai_refactor/refactors/ruby/refactor_ruby.rb
ai_refactor-0.5.1 lib/ai_refactor/refactors/ruby/refactor_ruby.rb
ai_refactor-0.5.0 lib/ai_refactor/refactors/ruby/refactor_ruby.rb