class Rake::TaskArguments
TaskArguments manage the arguments passed to a task.
###################################################################
def [](index)
def [](index) lookup(index.to_sym) end
def each(&block)
def each(&block) @hash.each(&block) end
def initialize(names, values, parent=nil)
(given by :names) and a set of associated values (given by
Create a TaskArgument object with a list of named arguments
def initialize(names, values, parent=nil) @names = names @parent = parent @hash = {} names.each_with_index { |name, i| @hash[name.to_sym] = values[i] unless values[i].nil? } end
def inspect
def inspect to_s end
def lookup(name)
def lookup(name) if @hash.has_key?(name) @hash[name] elsif @parent @parent.lookup(name) end end
def method_missing(sym, *args)
def method_missing(sym, *args) lookup(sym.to_sym) end
def new_scope(names)
Create a new argument scope using the prerequisite argument
def new_scope(names) values = names.collect { |n| self[n] } self.class.new(names, values, self) end
def to_hash
def to_hash @hash end
def to_s
def to_s @hash.inspect end
def values_at(*keys)
def values_at(*keys) keys.map { |k| lookup(k) } end
def with_defaults(defaults)
defaults only if there is no specific value for the given
Specify a hash of default values for task arguments. Use the
def with_defaults(defaults) @hash = defaults.merge(@hash) end