Class: Build::ChainNode

Inherits:
Graph::Node
  • Object
show all
Defined in:
lib/build/chain_node.rb

Overview

Responsible for processing a chain into a series of dependency nodes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chain, arguments, environment) ⇒ ChainNode

Returns a new instance of ChainNode.

Parameters:

  • chain (Chain)

    the chain to build.

  • arguments (Array)

    the arguments to pass to the output environment constructor.

  • anvironment (Build::Environment)

    the root environment to prepend into the chain.



33
34
35
36
37
38
39
40
# File 'lib/build/chain_node.rb', line 33

def initialize(chain, arguments, environment)
	@chain = chain
	@arguments = arguments
	@environment = environment
	
	# Wait here, for all dependent targets, to be done:
	super(Files::List::NONE, :inherit)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



43
44
45
# File 'lib/build/chain_node.rb', line 43

def arguments
  @arguments
end

#chainObject (readonly)

Returns the value of attribute chain.



42
43
44
# File 'lib/build/chain_node.rb', line 42

def chain
  @chain
end

#environmentObject (readonly)

Returns the value of attribute environment.



44
45
46
# File 'lib/build/chain_node.rb', line 44

def environment
  @environment
end

Instance Method Details

#==(other) ⇒ Object



46
47
48
49
50
51
# File 'lib/build/chain_node.rb', line 46

def == other
	super and
		@chain == other.chain and
		@arguments == other.arguments and
		@environment == other.environment
end

#apply!(task) ⇒ Object

This is the main entry point when invoking the node from ‘Build::Task`.



66
67
68
69
70
71
72
73
# File 'lib/build/chain_node.rb', line 66

def apply!(task)
	# Go through all the dependencies in order and apply them to the build graph:
	@chain.dependencies.each do |dependency|
		task.invoke(
			DependencyNode.new(@chain, dependency, @environment, @arguments)
		)
	end
end

#hashObject



53
54
55
# File 'lib/build/chain_node.rb', line 53

def hash
	super ^ @chain.hash ^ @arguments.hash ^ @environment.hash
end

#inspectObject



75
76
77
# File 'lib/build/chain_node.rb', line 75

def inspect
	"#<#{self.class} #{@environment.inspect}>"
end

#nameObject



61
62
63
# File 'lib/build/chain_node.rb', line 61

def name
	@environment.name
end

#task_class(parent_task) ⇒ Object



57
58
59
# File 'lib/build/chain_node.rb', line 57

def task_class(parent_task)
	Task
end