Class: Terraspace::Dependency::Node
- Inherits:
-
Object
- Object
- Terraspace::Dependency::Node
- Defined in:
- lib/terraspace/dependency/node.rb
Constant Summary collapse
- @@nodes =
[]
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#filtered ⇒ Object
Returns the value of attribute filtered.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parents ⇒ Object
Returns the value of attribute parents.
Class Method Summary collapse
Instance Method Summary collapse
- #highlighted? ⇒ Boolean
-
#initialize(name) ⇒ Node
constructor
A new instance of Node.
- #inspect ⇒ Object
- #parent!(parent) ⇒ Object
Constructor Details
#initialize(name) ⇒ Node
Returns a new instance of Node.
5 6 7 8 |
# File 'lib/terraspace/dependency/node.rb', line 5 def initialize(name) @name = name @children, @parents = Set.new, Set.new end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
4 5 6 |
# File 'lib/terraspace/dependency/node.rb', line 4 def children @children end |
#filtered ⇒ Object
Returns the value of attribute filtered.
4 5 6 |
# File 'lib/terraspace/dependency/node.rb', line 4 def filtered @filtered end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/terraspace/dependency/node.rb', line 3 def name @name end |
#parents ⇒ Object
Returns the value of attribute parents.
4 5 6 |
# File 'lib/terraspace/dependency/node.rb', line 4 def parents @parents end |
Class Method Details
.find_by(name:) ⇒ Object
33 34 35 |
# File 'lib/terraspace/dependency/node.rb', line 33 def find_by(name:) @@nodes.find { |n| n.name == name } end |
Instance Method Details
#highlighted? ⇒ Boolean
10 11 12 |
# File 'lib/terraspace/dependency/node.rb', line 10 def highlighted? @filtered end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/terraspace/dependency/node.rb', line 14 def inspect @name end |
#parent!(parent) ⇒ Object
18 19 20 21 |
# File 'lib/terraspace/dependency/node.rb', line 18 def parent!(parent) @parents << parent parent.children << self end |