Class | Rake::TaskArguments
In: | lib/rake.rb
Parent: | Object

TaskAguments manage the arguments passed to a task.

### Methods

[] each inspect lookup method_missing new new_scope to_hash to_s with_defaults

### Included Modules

Enumerable

### Attributes

names | [R] |

### Public Class methods

new(names, values, parent=nil)

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.

[Source]

         # 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

### Public Instance methods

[](index)

Find an argument value by name or index.

[Source]

         # File lib/rake.rb, line 339
    339:     def [](index)
    340:       lookup(index.to_sym)
    341:     end

each(&block)

[Source]

         # File lib/rake.rb, line 350
    350:     def each(&block)
    351:       @hash.each(&block)
    352:     end

inspect()

[Source]

         # File lib/rake.rb, line 366
    366:     def inspect
    367:       to_s
    368:     end

method_missing(sym, *args, &block)

[Source]

         # File lib/rake.rb, line 354
    354:     def method_missing(sym, *args, &block)
    355:       lookup(sym.to_sym)
    356:     end

new_scope(names)

Create a new argument scope using the prerequisite argument names.

[Source]

         # File lib/rake.rb, line 333
    333:     def new_scope(names)
    334:       values = names.collect { |n| self[n] }
    335:       self.class.new(names, values, self)
    336:     end

to_hash()

[Source]

         # File lib/rake.rb, line 358
    358:     def to_hash
    359:       @hash
    360:     end

to_s()

[Source]

         # File lib/rake.rb, line 362
    362:     def to_s
    363:       @hash.inspect
    364:     end

with_defaults(defaults)

Specify a hash of default values for task arguments. Use the defaults only if there is no specific value for the given argument.

[Source]

         # File lib/rake.rb, line 346
    346:     def with_defaults(defaults)
    347:       @hash = defaults.merge(@hash)
    348:     end

### Protected Instance methods

lookup(name)

[Source]

         # File lib/rake.rb, line 372
    372:     def lookup(name)
    373:       if @hash.has_key?(name)
    374:         @hash[name]
    375:       elsif ENV.has_key?(name.to_s)
    376:         ENV[name.to_s]
    377:       elsif ENV.has_key?(name.to_s.upcase)
    378:         ENV[name.to_s.upcase]
    379:       elsif @parent
    380:         @parent.lookup(name)
    381:       end
    382:     end

[Validate]