TaskAguments manage the arguments passed to a task.
Methods
Included Modules
- Enumerable
Attributes
[R] | names |
Public Class methods
[ show source ]
# File lib/rake.rb, line 289 289: def initialize(names, values, parent=nil) 290: @names = names 291: @parent = parent 292: @hash = {} 293: names.each_with_index { |name, i| 294: @hash[name.to_sym] = values[i] 295: } 296: end
Public Instance methods
Find an argument value by name or index.
[ show source ]
# File lib/rake.rb, line 306 306: def [](index) 307: lookup(index.to_sym) 308: end
[ show source ]
# File lib/rake.rb, line 310 310: def each(&block) 311: @hash.each(&block) 312: end
[ show source ]
# File lib/rake.rb, line 326 326: def inspect 327: to_s 328: end
[ show source ]
# File lib/rake.rb, line 314 314: def method_missing(sym, *args, &block) 315: lookup(sym.to_sym) 316: end
Create a new argument scope using the prerequisite argument names.
[ show source ]
# File lib/rake.rb, line 300 300: def new_scope(names) 301: values = names.collect { |n| self[n] } 302: self.class.new(names, values, self) 303: end
[ show source ]
# File lib/rake.rb, line 318 318: def to_hash 319: @hash 320: end
[ show source ]
# File lib/rake.rb, line 322 322: def to_s 323: @hash.inspect 324: end
Protected Instance methods
[ show source ]
# File lib/rake.rb, line 332 332: def lookup(name) 333: if @hash.has_key?(name) 334: @hash[name] 335: elsif ENV.has_key?(name.to_s) 336: ENV[name.to_s] 337: elsif ENV.has_key?(name.to_s.upcase) 338: ENV[name.to_s.upcase] 339: elsif @parent 340: @parent.lookup(name) 341: end 342: end