Class: Testgenai::Configuration
- Inherits:
-
Object
- Object
- Testgenai::Configuration
- Defined in:
- lib/testgenai/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#framework ⇒ Object
readonly
Returns the value of attribute framework.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#pause ⇒ Object
readonly
Returns the value of attribute pause.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
- #generator_class ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #validator_class ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 10 11 12 |
# File 'lib/testgenai/configuration.rb', line 5 def initialize( = {}) @provider = [:provider] || ENV["TESTGENAI_PROVIDER"] @model = [:model] || ENV["TESTGENAI_MODEL"] @api_key = [:api_key] @framework = [:framework] || ENV["TESTGENAI_FRAMEWORK"] || "rspec" @output_dir = [:output_dir] || ENV["TESTGENAI_OUTPUT_DIR"] @pause = ([:pause] || ENV["TESTGENAI_PAUSE"] || 1).to_f end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def api_key @api_key end |
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def framework @framework end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def model @model end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def output_dir @output_dir end |
#pause ⇒ Object (readonly)
Returns the value of attribute pause.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def pause @pause end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
3 4 5 |
# File 'lib/testgenai/configuration.rb', line 3 def provider @provider end |
Instance Method Details
#generator_class ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/testgenai/configuration.rb', line 14 def generator_class case framework when "rspec" then Generator::RspecGenerator when "minitest" then Generator::MinitestGenerator else raise ConfigurationError, "Unknown framework: #{framework}" end end |
#validator_class ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/testgenai/configuration.rb', line 22 def validator_class case framework when "rspec" then Validator::RspecValidator when "minitest" then Validator::MinitestValidator else raise ConfigurationError, "Unknown framework: #{framework}" end end |