Class: Rake::Pipeline::Graph::Node
- Inherits:
-
Object
- Object
- Rake::Pipeline::Graph::Node
- Defined in:
- lib/rake-pipeline/graph.rb
Instance Attribute Summary collapse
-
#children ⇒ Set
readonly
A Set of child nodes.
-
#metadata ⇒ Hash
readonly
A Hash of metadata.
-
#name ⇒ String
readonly
The identifier of the node.
-
#parents ⇒ Set
readonly
A Set of parent nodes.
Instance Method Summary collapse
-
#==(other) ⇒ Object
A node is equal another node if it has the same name.
-
#initialize(name, metadata = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(name, metadata = {}) ⇒ Node
Returns a new instance of Node.
53 54 55 56 57 58 |
# File 'lib/rake-pipeline/graph.rb', line 53 def initialize(name, ={}) @name = name @parents = Set.new @children = Set.new @metadata = end |
Instance Attribute Details
#children ⇒ Set (readonly)
Returns a Set of child nodes.
46 47 48 |
# File 'lib/rake-pipeline/graph.rb', line 46 def children @children end |
#metadata ⇒ Hash (readonly)
Returns a Hash of metadata.
49 50 51 |
# File 'lib/rake-pipeline/graph.rb', line 49 def @metadata end |
#name ⇒ String (readonly)
Returns the identifier of the node.
40 41 42 |
# File 'lib/rake-pipeline/graph.rb', line 40 def name @name end |
#parents ⇒ Set (readonly)
Returns a Set of parent nodes.
43 44 45 |
# File 'lib/rake-pipeline/graph.rb', line 43 def parents @parents end |
Instance Method Details
#==(other) ⇒ Object
A node is equal another node if it has the same name. This is because the Graph ensures that only one node with a given name can be created.
65 66 67 |
# File 'lib/rake-pipeline/graph.rb', line 65 def ==(other) @name == other.name end |