Class: ChronoForge::Definition
- Inherits:
-
Object
- Object
- ChronoForge::Definition
- 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
Instance Attribute Summary collapse
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(nodes: [], edges: [], warnings: []) ⇒ Definition
constructor
A new instance of Definition.
- #to_h ⇒ Object
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
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
25 26 27 |
# File 'lib/chrono_forge/definition.rb', line 25 def edges @edges end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
25 26 27 |
# File 'lib/chrono_forge/definition.rb', line 25 def nodes @nodes end |
#warnings ⇒ Object (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_h ⇒ Object
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 |