Class: Testgenai::ConventionsSynthesizer
- Inherits:
-
Object
- Object
- Testgenai::ConventionsSynthesizer
- Defined in:
- lib/testgenai/conventions_synthesizer.rb
Instance Method Summary collapse
-
#initialize(config, root: Dir.pwd, cache_path: nil) ⇒ ConventionsSynthesizer
constructor
A new instance of ConventionsSynthesizer.
- #synthesize ⇒ Object
Constructor Details
#initialize(config, root: Dir.pwd, cache_path: nil) ⇒ ConventionsSynthesizer
Returns a new instance of ConventionsSynthesizer.
6 7 8 9 10 |
# File 'lib/testgenai/conventions_synthesizer.rb', line 6 def initialize(config, root: Dir.pwd, cache_path: nil) @config = config @root = root @cache_path = cache_path || default_cache_path end |
Instance Method Details
#synthesize ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/testgenai/conventions_synthesizer.rb', line 12 def synthesize return File.read(@cache_path) if cache_valid? facts = ConventionsExtractor.new(root: @root).extract return nil if facts.nil? conventions = call_llm(facts) FileUtils.mkdir_p(File.dirname(@cache_path)) File.write(@cache_path, conventions) conventions end |