Class: AIRefactor::RunConfiguration
- Inherits:
-
Object
- Object
- AIRefactor::RunConfiguration
- Defined in:
- lib/ai_refactor/run_configuration.rb
Instance Attribute Summary collapse
- #ai_max_tokens ⇒ Object
- #ai_temperature ⇒ Object
- #ai_timeout ⇒ Object
-
#context_file_paths ⇒ Object
Returns the value of attribute context_file_paths.
-
#context_file_paths_from_gems ⇒ Object
Returns the value of attribute context_file_paths_from_gems.
-
#context_text ⇒ Object
Returns the value of attribute context_text.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#description ⇒ Object
Returns the value of attribute description.
-
#diff ⇒ Object
Returns the value of attribute diff.
-
#input_file_paths ⇒ Object
Returns the value of attribute input_file_paths.
- #minitest_run_command ⇒ Object
-
#output_file_path ⇒ Object
Returns the value of attribute output_file_path.
-
#output_template_path ⇒ Object
Returns the value of attribute output_template_path.
-
#overwrite ⇒ Object
Returns the value of attribute overwrite.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#prompt_file_path ⇒ Object
Returns the value of attribute prompt_file_path.
-
#refactor ⇒ Object
Returns the value of attribute refactor.
-
#review_prompt ⇒ Object
Returns the value of attribute review_prompt.
- #rspec_run_command ⇒ Object
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object deprecated Deprecated.
- #ai_max_attempts ⇒ Object
- #ai_max_attempts=(value) ⇒ Object
- #ai_model ⇒ Object
- #ai_model=(value) ⇒ Object
- #ai_platform ⇒ Object
- #set!(hash) ⇒ Object
- #to_options ⇒ Object
Instance Attribute Details
#ai_max_tokens ⇒ Object
125 126 127 |
# File 'lib/ai_refactor/run_configuration.rb', line 125 def ai_max_tokens @ai_max_tokens || 1500 end |
#ai_temperature ⇒ Object
119 120 121 |
# File 'lib/ai_refactor/run_configuration.rb', line 119 def ai_temperature @ai_temperature || 0.7 end |
#ai_timeout ⇒ Object
131 132 133 |
# File 'lib/ai_refactor/run_configuration.rb', line 131 def ai_timeout @ai_timeout || 60 end |
#context_file_paths ⇒ Object
Returns the value of attribute context_file_paths.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def context_file_paths @context_file_paths end |
#context_file_paths_from_gems ⇒ Object
Returns the value of attribute context_file_paths_from_gems.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def context_file_paths_from_gems @context_file_paths_from_gems end |
#context_text ⇒ Object
Returns the value of attribute context_text.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def context_text @context_text end |
#debug ⇒ Object
Returns the value of attribute debug.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def debug @debug end |
#description ⇒ Object
Returns the value of attribute description.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def description @description end |
#diff ⇒ Object
Returns the value of attribute diff.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def diff @diff end |
#input_file_paths ⇒ Object
Returns the value of attribute input_file_paths.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def input_file_paths @input_file_paths end |
#minitest_run_command ⇒ Object
88 89 90 |
# File 'lib/ai_refactor/run_configuration.rb', line 88 def minitest_run_command @minitest_run_command || "ruby __FILE__" end |
#output_file_path ⇒ Object
Returns the value of attribute output_file_path.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def output_file_path @output_file_path end |
#output_template_path ⇒ Object
Returns the value of attribute output_template_path.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def output_template_path @output_template_path end |
#overwrite ⇒ Object
Returns the value of attribute overwrite.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def overwrite @overwrite end |
#prompt ⇒ Object
Returns the value of attribute prompt.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def prompt @prompt end |
#prompt_file_path ⇒ Object
Returns the value of attribute prompt_file_path.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def prompt_file_path @prompt_file_path end |
#refactor ⇒ Object
Returns the value of attribute refactor.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def refactor @refactor end |
#review_prompt ⇒ Object
Returns the value of attribute review_prompt.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def review_prompt @review_prompt end |
#rspec_run_command ⇒ Object
84 85 86 |
# File 'lib/ai_refactor/run_configuration.rb', line 84 def rspec_run_command @rspec_run_command || "bundle exec rspec __FILE__" end |
#verbose ⇒ Object
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/ai_refactor/run_configuration.rb', line 10 def verbose @verbose end |
Class Method Details
.add_new_option(key) ⇒ Object
5 6 7 8 |
# File 'lib/ai_refactor/run_configuration.rb', line 5 def self.add_new_option(key) self.class.define_method(key) { instance_variable_get("@#{key}") } self.class.define_method("#{key}=") { |v| instance_variable_set("@#{key}", v) } end |
Instance Method Details
#[](key) ⇒ Object
36 37 38 |
# File 'lib/ai_refactor/run_configuration.rb', line 36 def [](key) send(key) end |
#ai_max_attempts ⇒ Object
95 96 97 |
# File 'lib/ai_refactor/run_configuration.rb', line 95 def ai_max_attempts @ai_max_attempts || 3 end |
#ai_max_attempts=(value) ⇒ Object
99 100 101 |
# File 'lib/ai_refactor/run_configuration.rb', line 99 def ai_max_attempts=(value) @ai_max_attempts = value end |
#ai_model ⇒ Object
103 104 105 |
# File 'lib/ai_refactor/run_configuration.rb', line 103 def ai_model @ai_model || "gpt-4-turbo" end |
#ai_model=(value) ⇒ Object
107 108 109 |
# File 'lib/ai_refactor/run_configuration.rb', line 107 def ai_model=(value) @ai_model = value end |
#ai_platform ⇒ Object
111 112 113 114 115 116 117 |
# File 'lib/ai_refactor/run_configuration.rb', line 111 def ai_platform if ai_model&.start_with?("claude") "anthropic" else "openai" end end |
#set!(hash) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ai_refactor/run_configuration.rb', line 26 def set!(hash) hash.each do |key, value| raise StandardError, "Invalid option: #{key}" unless respond_to?("#{key}=") send("#{key}=", value) end end |
#to_options ⇒ Object
149 150 151 152 153 |
# File 'lib/ai_refactor/run_configuration.rb', line 149 def instance_variables.each_with_object({}) do |var, hash| hash[var.to_s.delete("@").to_sym] = instance_variable_get(var) end end |