Class: Woods::FlowAssembler
- Inherits:
-
Object
- Object
- Woods::FlowAssembler
- Defined in:
- lib/woods/flow_assembler.rb
Overview
Orchestrates execution flow tracing from an entry point through the dependency graph.
Given an entry point (e.g., “PostsController#create”), FlowAssembler:
-
Loads the ExtractedUnit JSON from disk
-
Parses its source_code with the AST layer
-
Extracts operations in source line order
-
Recursively expands targets that resolve to other units
-
Detects cycles and respects max_depth
-
Assembles a FlowDocument
Instance Method Summary collapse
-
#assemble(entry_point, max_depth: 5) ⇒ FlowDocument
Assemble an execution flow from the given entry point.
-
#initialize(graph:, extracted_dir:) ⇒ FlowAssembler
constructor
A new instance of FlowAssembler.
Constructor Details
#initialize(graph:, extracted_dir:) ⇒ FlowAssembler
Returns a new instance of FlowAssembler.
30 31 32 33 34 35 36 |
# File 'lib/woods/flow_assembler.rb', line 30 def initialize(graph:, extracted_dir:) @graph = graph @extracted_dir = extracted_dir @parser = Ast::Parser.new @method_extractor = Ast::MethodExtractor.new(parser: @parser) @operation_extractor = FlowAnalysis::OperationExtractor.new end |
Instance Method Details
#assemble(entry_point, max_depth: 5) ⇒ FlowDocument
Assemble an execution flow from the given entry point.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/woods/flow_assembler.rb', line 43 def assemble(entry_point, max_depth: 5) visited = Set.new steps = [] (entry_point, steps, visited, depth: 0, max_depth: max_depth) route = extract_route(entry_point) FlowDocument.new( entry_point: entry_point, route: route, max_depth: max_depth, steps: steps ) end |