method
complete
ruby latest stable - Class:
OptionParser
complete(typ, opt, icase = false, *pat)private
Completes shortened long style option switch and returns pair of canonical switch and switch descriptor OptionParser::Switch.
typ
Searching table.
opt
Searching key.
icase
Search case insensitive if true.
pat
Optional pattern for completion.
# File lib/optparse.rb, line 1733
def complete(typ, opt, icase = false, *pat)
if pat.empty?
search(typ, opt) {|sw| return [sw, opt]} # exact match or...
end
raise AmbiguousOption, catch(:ambiguous) {
visit(:complete, typ, opt, icase, *pat) {|o, *sw| return sw}
raise InvalidOption, opt
}
end