In Files

Parent

Included Modules

Rake::TaskArguments

                                                                  

TaskAguments manage the arguments passed to a task.

Attributes

names[R]

Public Class Methods

new(names, values, parent=nil) click to toggle source

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 341
341:     def initialize(names, values, parent=nil)
342:       @names = names
343:       @parent = parent
344:       @hash = {}
345:       names.each_with_index { |name, i|
346:         @hash[name.to_sym] = values[i] unless values[i].nil?
347:       }
348:     end

Public Instance Methods

[](index) click to toggle source

Find an argument value by name or index.

     # File lib/rake.rb, line 358
358:     def [](index)
359:       lookup(index.to_sym)
360:     end
each(&block) click to toggle source
     # File lib/rake.rb, line 369
369:     def each(&block)
370:       @hash.each(&block)
371:     end
inspect() click to toggle source
     # File lib/rake.rb, line 385
385:     def inspect
386:       to_s
387:     end
method_missing(sym, *args, &block) click to toggle source
     # File lib/rake.rb, line 373
373:     def method_missing(sym, *args, &block)
374:       lookup(sym.to_sym)
375:     end
new_scope(names) click to toggle source

Create a new argument scope using the prerequisite argument names.

     # File lib/rake.rb, line 352
352:     def new_scope(names)
353:       values = names.collect { |n| self[n] }
354:       self.class.new(names, values, self)
355:     end
to_hash() click to toggle source
     # File lib/rake.rb, line 377
377:     def to_hash
378:       @hash
379:     end
to_s() click to toggle source
     # File lib/rake.rb, line 381
381:     def to_s
382:       @hash.inspect
383:     end
with_defaults(defaults) click to toggle source

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 365
365:     def with_defaults(defaults)
366:       @hash = defaults.merge(@hash)
367:     end

Protected Instance Methods

lookup(name) click to toggle source
     # File lib/rake.rb, line 391
391:     def lookup(name)
392:       if @hash.has_key?(name)
393:         @hash[name]
394:       elsif ENV.has_key?(name.to_s)
395:         ENV[name.to_s]
396:       elsif ENV.has_key?(name.to_s.upcase)
397:         ENV[name.to_s.upcase]
398:       elsif @parent
399:         @parent.lookup(name)
400:       end
401:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.