Class: Docit::SystemGraph::Node
- Inherits:
-
Object
- Object
- Docit::SystemGraph::Node
- Defined in:
- lib/docit/system_graph/node.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id:, type:, label:, metadata: {}, file: nil, line: nil, status: nil) ⇒ Node
constructor
A new instance of Node.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, type:, label:, metadata: {}, file: nil, line: nil, status: nil) ⇒ Node
Returns a new instance of Node.
8 9 10 11 12 13 14 15 16 |
# File 'lib/docit/system_graph/node.rb', line 8 def initialize(id:, type:, label:, metadata: {}, file: nil, line: nil, status: nil) @id = id.to_s @type = type.to_s @label = label.to_s @metadata = @file = file @line = line @status = status end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def file @file end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def label @label end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def line @line end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def @metadata end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/docit/system_graph/node.rb', line 6 def type @type end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/docit/system_graph/node.rb', line 18 def to_h { id: id, type: type, label: label, metadata: }.tap do |hash| hash[:file] = file if file hash[:line] = line if line hash[:status] = status if status end end |