Class: SpecForge::Documentation::Builder
- Inherits:
-
Object
- Object
- SpecForge::Documentation::Builder
- Defined in:
- lib/spec_forge/documentation/builder.rb,
lib/spec_forge/documentation/builder/cache.rb,
lib/spec_forge/documentation/builder/compiler.rb,
lib/spec_forge/documentation/builder/extractor.rb
Overview
Builds API documentation by running blueprints and extracting endpoint data
The Builder orchestrates the documentation generation process by:
- Loading and running blueprint test files
- Capturing request/response data from successful test executions
- Compiling the raw data into a structured Document
It supports caching to avoid re-running tests when blueprints haven't changed.
Defined Under Namespace
Classes: Cache, Compiler, Extractor
Class Method Summary collapse
-
.create_document! ⇒ Document
Creates a complete Document from blueprint files.
Instance Method Summary collapse
-
#endpoints ⇒ Array<Hash>
Extracts endpoint data from blueprint test executions.
-
#initialize(base_path: nil, paths: nil, verbosity_level: 0, use_cache: false) ⇒ Builder
constructor
Creates a new Builder instance.
Constructor Details
#initialize(base_path: nil, paths: nil, verbosity_level: 0, use_cache: false) ⇒ Builder
Creates a new Builder instance
56 57 58 59 60 61 62 63 |
# File 'lib/spec_forge/documentation/builder.rb', line 56 def initialize(base_path: nil, paths: nil, verbosity_level: 0, use_cache: false) @cache = Cache.new @base_path = base_path @paths = paths @use_cache = use_cache @verbosity_level = verbosity_level end |
Class Method Details
.create_document! ⇒ Document
Creates a complete Document from blueprint files
This is the primary entry point for generating documentation. It instantiates a Builder, extracts endpoints, compiles them, and returns a structured Document object.
39 40 41 42 43 44 |
# File 'lib/spec_forge/documentation/builder.rb', line 39 def self.create_document!(**) endpoints = new(**).endpoints endpoints = Compiler.new(endpoints).compile Document.new(endpoints:) end |
Instance Method Details
#endpoints ⇒ Array<Hash>
Extracts endpoint data from blueprint test executions
Runs all blueprints and captures request/response data from each successful test step. Results are cached for subsequent calls when caching is enabled.
77 78 79 80 81 82 83 84 |
# File 'lib/spec_forge/documentation/builder.rb', line 77 def endpoints return @cache.read if @use_cache && @cache.valid? endpoints = capture_endpoint_data @cache.create(endpoints) endpoints end |