Sha256: 43300b07bfaf381b148fb69e1d1e1079bd2e40f6d6cbccd0988dfa53918bc399

Contents?: true

Size: 822 Bytes

Versions: 6

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

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

          return false unless output_content

          output_file_path ? true : output_content
        end

        def self.takes_input_files?
          false
        end

        def self.description
          "User supplied prompt to write Ruby code"
        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/write_ruby.rb
ai_refactor-0.5.4 lib/ai_refactor/refactors/ruby/write_ruby.rb
ai_refactor-0.5.3 lib/ai_refactor/refactors/ruby/write_ruby.rb
ai_refactor-0.5.2 lib/ai_refactor/refactors/ruby/write_ruby.rb
ai_refactor-0.5.1 lib/ai_refactor/refactors/ruby/write_ruby.rb
ai_refactor-0.5.0 lib/ai_refactor/refactors/ruby/write_ruby.rb