Class: ChronoForge::Definition

Inherits:
Object
  • Object
show all
Defined in:
lib/chrono_forge/definition.rb

Overview

Rendering-agnostic graph model produced by DefinitionAnalyzer. Plain value objects so a Definition can be cached/serialized (to_h -> JSON) and consumed by any renderer. No DB, no Prism, no dashboard dependency here.

Defined Under Namespace

Classes: Edge, Node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nodes: [], edges: [], warnings: []) ⇒ Definition

Returns a new instance of Definition.



27
28
29
30
31
# File 'lib/chrono_forge/definition.rb', line 27

def initialize(nodes: [], edges: [], warnings: [])
  @nodes = nodes
  @edges = edges
  @warnings = warnings
end

Instance Attribute Details

#edgesObject (readonly)

Returns the value of attribute edges.



25
26
27
# File 'lib/chrono_forge/definition.rb', line 25

def edges
  @edges
end

#nodesObject (readonly)

Returns the value of attribute nodes.



25
26
27
# File 'lib/chrono_forge/definition.rb', line 25

def nodes
  @nodes
end

#warningsObject (readonly)

Returns the value of attribute warnings.



25
26
27
# File 'lib/chrono_forge/definition.rb', line 25

def warnings
  @warnings
end

Instance Method Details

#to_hObject



33
34
35
# File 'lib/chrono_forge/definition.rb', line 33

def to_h
  {nodes: nodes.map(&:to_h), edges: edges.map(&:to_h), warnings: warnings}
end