Class: Build::BuildNode
- Inherits:
-
Graph::Node
- Object
- Graph::Node
- Build::BuildNode
- Defined in:
- lib/build/build_node.rb
Overview
Represents a build graph node that applies a single provision to produce an output environment.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#provision ⇒ Object
readonly
Returns the value of attribute provision.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#apply!(task) ⇒ Object
Apply this node to the given task, constructing the output environment.
- #hash ⇒ Object
- #initial_environment ⇒ Object
-
#initialize(environment, provision, arguments) ⇒ BuildNode
constructor
Initialize the build node with an environment, provision, and arguments.
- #name ⇒ Object
- #task_class(parent_task) ⇒ Object
Constructor Details
#initialize(environment, provision, arguments) ⇒ BuildNode
Initialize the build node with an environment, provision, and arguments.
19 20 21 22 23 24 25 |
# File 'lib/build/build_node.rb', line 19 def initialize(environment, provision, arguments) @environment = environment @provision = provision @arguments = arguments super(Files::List::NONE, :inherit) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
29 30 31 |
# File 'lib/build/build_node.rb', line 29 def arguments @arguments end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
27 28 29 |
# File 'lib/build/build_node.rb', line 27 def environment @environment end |
#provision ⇒ Object (readonly)
Returns the value of attribute provision.
28 29 30 |
# File 'lib/build/build_node.rb', line 28 def provision @provision end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/build/build_node.rb', line 32 def == other super and @environment == other.environment and @provision == other.provision and @arguments == other.arguments end |
#apply!(task) ⇒ Object
Apply this node to the given task, constructing the output environment.
61 62 63 64 65 66 67 |
# File 'lib/build/build_node.rb', line 61 def apply!(task) output_environment = self.initial_environment output_environment.construct!(task, *@arguments, &@provision.value) task.output_environment = output_environment end |
#hash ⇒ Object
40 41 42 |
# File 'lib/build/build_node.rb', line 40 def hash super ^ @environment.hash ^ @provision.hash ^ @arguments.hash end |
#initial_environment ⇒ Object
50 51 52 |
# File 'lib/build/build_node.rb', line 50 def initial_environment Build::Environment.new(@environment) end |
#name ⇒ Object
55 56 57 |
# File 'lib/build/build_node.rb', line 55 def name @environment.name end |