Class: Appydave::Tools::GptContext::OutputHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/appydave/tools/gpt_context/output_handler.rb

Overview

OutputHandler is responsible for writing the output to the desired target

Instance Method Summary collapse

Constructor Details

#initialize(content, options) ⇒ OutputHandler

Returns a new instance of OutputHandler.



8
9
10
11
12
# File 'lib/appydave/tools/gpt_context/output_handler.rb', line 8

def initialize(content, options)
  @content = content
  @output_targets = options.output_target
  @working_directory = options.working_directory
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/appydave/tools/gpt_context/output_handler.rb', line 14

def execute
  @output_targets.each do |target|
    case target
    when 'clipboard'
      Clipboard.copy(@content)
    when /^.+$/
      write_to_file(target)
    end
  end
end