Class: Build::TargetNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_class, target) ⇒ TargetNode

Returns a new instance of TargetNode.



26
27
28
29
30
31
32
# File 'lib/build/target_node.rb', line 26

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

Instance Attribute Details

#task_classObject (readonly)

Returns the value of attribute task_class.



34
35
36
# File 'lib/build/target_node.rb', line 34

def task_class
  @task_class
end

Instance Method Details

#apply!(scope) ⇒ Object



40
41
42
# File 'lib/build/target_node.rb', line 40

def apply!(scope)
	scope.instance_exec(&@target.build)
end

#inspectObject



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

def inspect
	@task_class.name.inspect
end

#nameObject



36
37
38
# File 'lib/build/target_node.rb', line 36

def name
	@task_class.name
end

#to_sObject



48
49
50
# File 'lib/build/target_node.rb', line 48

def to_s
	"#<#{self.class} #{@target.name}>"
end