Class: Docit::SystemGraph::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/docit/system_graph/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def file
  @file
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def id
  @id
end

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def label
  @label
end

#lineObject (readonly)

Returns the value of attribute line.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def line
  @line
end

#metadataObject (readonly)

Returns the value of attribute metadata.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def 
  @metadata
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/docit/system_graph/node.rb', line 6

def status
  @status
end

#typeObject (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_hObject



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