lib/build/rule.rb in build-1.0.8 vs lib/build/rule.rb in build-1.0.9

- old
+ new

@@ -46,17 +46,22 @@ def dynamic? @dynamic != nil end + # Do we have a default value for this parameter? + def default? + @options.key?(:default) + end + def implicit? dynamic? and @options[:implicit] end # Optional parameters are those that are either defined as optional or implicit. def optional? - @options[:optional] || implicit? + @options[:optional] || implicit? || default? end def applicable? arguments value = arguments.fetch(@name) do # Value couldn't be found, if it wasn't optional, this parameter didn't apply: @@ -78,10 +83,10 @@ elsif dynamic? # Argument is optional: scope.instance_exec(arguments[@name], arguments, &@dynamic) else arguments[@name] - end + end || @options[:default] end def inspect "#{direction}:#{@name} (#{options.inspect})" end