| Class | Rake::TaskArguments |
| In: |
lib/rake.rb
|
| Parent: | Object |
TaskAguments manage the arguments passed to a task.
| names | [R] |
Create a TaskArgument object with a list of named arguments (given by :names) and a set of associated values (given by :values). :parent is the parent argument object.
# File lib/rake.rb, line 322
322: def initialize(names, values, parent=nil)
323: @names = names
324: @parent = parent
325: @hash = {}
326: names.each_with_index { |name, i|
327: @hash[name.to_sym] = values[i] unless values[i].nil?
328: }
329: end
Find an argument value by name or index.
# File lib/rake.rb, line 339
339: def [](index)
340: lookup(index.to_sym)
341: end
# File lib/rake.rb, line 354
354: def method_missing(sym, *args, &block)
355: lookup(sym.to_sym)
356: end
Specify a hash of default values for task arguments. Use the defaults only if there is no specific value for the given argument.
# File lib/rake.rb, line 346
346: def with_defaults(defaults)
347: @hash = defaults.merge(@hash)
348: end