Class: Build::RuleNode
- Inherits:
-
Graph::Node
- Object
- Graph::Node
- Build::RuleNode
- Defined in:
- lib/build/rule_node.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #apply!(scope) ⇒ Object
- #hash ⇒ Object
-
#initialize(rule, arguments, &block) ⇒ RuleNode
constructor
A new instance of RuleNode.
- #inspect ⇒ Object
- #name ⇒ Object
- #task_class(parent_task) ⇒ Object
Constructor Details
#initialize(rule, arguments, &block) ⇒ RuleNode
Returns a new instance of RuleNode.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/build/rule_node.rb', line 25 def initialize(rule, arguments, &block) @arguments = arguments @rule = rule @callback = block inputs, outputs = @rule.files(@arguments) super(inputs, outputs) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
36 37 38 |
# File 'lib/build/rule_node.rb', line 36 def arguments @arguments end |
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
38 39 40 |
# File 'lib/build/rule_node.rb', line 38 def callback @callback end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
37 38 39 |
# File 'lib/build/rule_node.rb', line 37 def rule @rule end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/build/rule_node.rb', line 40 def == other super and @arguments == other.arguments and @rule == other.rule and @callback == other.callback end |
#apply!(scope) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/build/rule_node.rb', line 59 def apply!(scope) @rule.apply!(scope, @arguments) if @callback scope.instance_exec(@arguments, &@callback) end end |
#hash ⇒ Object
47 48 49 |
# File 'lib/build/rule_node.rb', line 47 def hash super ^ @arguments.hash ^ @rule.hash ^ @callback.hash end |
#inspect ⇒ Object
67 68 69 |
# File 'lib/build/rule_node.rb', line 67 def inspect @rule.name.inspect end |
#name ⇒ Object
55 56 57 |
# File 'lib/build/rule_node.rb', line 55 def name @rule.name end |
#task_class(parent_task) ⇒ Object
51 52 53 |
# File 'lib/build/rule_node.rb', line 51 def task_class(parent_task) parent_task.class end |