Class: Build::RuleNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, arguments, &block) ⇒ RuleNode

Returns a new instance of RuleNode.



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

def initialize(rule, arguments, &block)
  @arguments = arguments
  @rule = rule
  
  @callback = block
  
  inputs, outputs = @rule.files(@arguments)
  
  super(inputs, outputs, @rule)
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



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

def arguments
  @arguments
end

#callbackObject (readonly)

Returns the value of attribute callback.



46
47
48
# File 'lib/build/controller.rb', line 46

def callback
  @callback
end

#ruleObject (readonly)

Returns the value of attribute rule.



45
46
47
# File 'lib/build/controller.rb', line 45

def rule
  @rule
end

Instance Method Details

#apply!(scope) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/build/controller.rb', line 52

def apply!(scope)
  @rule.apply!(scope, @arguments)
  
  if @callback
    scope.instance_exec(@arguments, &@callback)
  end
end

#inspectObject



60
61
62
# File 'lib/build/controller.rb', line 60

def inspect
  @rule.name.inspect
end

#titleObject



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

def title
  @rule.title
end