In: |
optparse.rb
|
Parent: | Object |
atype | [R] | |
list | [R] | |
long | [R] | |
short | [R] |
# File optparse.rb, line 507 def initialize @atype = {} @short = OptionMap.new @long = OptionCaseMap.new @list = [] end
# File optparse.rb, line 535 def accept(t, pat = /.*/, &block) if pat pat.respond_to?(:match) or raise TypeError, "has no `match'" else pat = t if t.respond_to?(:match) end unless block block = pat.method(:convert).to_proc if pat.respond_to?(:convert) end @atype[t] = [pat, block] end
# File optparse.rb, line 613 def search(id, key) if list = __send__(id) val = list.fetch(key) {return nil} return val unless block_given? yield(val) end end
# File optparse.rb, line 634 def complete(id, opt, *pat, &block) __send__(id).complete(opt, *pat, &block) end