Class: Rake::Pipeline::Graph::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rake-pipeline/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, metadata = {}) ⇒ Node

Returns a new instance of Node.

Parameters:

  • name (String)

    the identifier of the node

  • metadata (Hash) (defaults to: {})

    an optional hash of metadata



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

#childrenSet (readonly)

Returns a Set of child nodes.

Returns:

  • (Set)

    a Set of child nodes



46
47
48
# File 'lib/rake-pipeline/graph.rb', line 46

def children
  @children
end

#metadataHash (readonly)

Returns a Hash of metadata.

Returns:

  • (Hash)

    a Hash of metadata



49
50
51
# File 'lib/rake-pipeline/graph.rb', line 49

def 
  @metadata
end

#nameString (readonly)

Returns the identifier of the node.

Returns:

  • (String)

    the identifier of the node



40
41
42
# File 'lib/rake-pipeline/graph.rb', line 40

def name
  @name
end

#parentsSet (readonly)

Returns a Set of parent nodes.

Returns:

  • (Set)

    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.

Parameters:

  • other (Node)

    the node to compare



65
66
67
# File 'lib/rake-pipeline/graph.rb', line 65

def ==(other)
  @name == other.name
end