APIdock / Ruby
/
method

candidate

ruby latest stable - Class: OptionParser
candidate(word)
public

No documentation available.

# File lib/optparse.rb, line 1744
 def candidate(word)
 list = []
 case word
 when '-'
 long = short = true
 when /\A--/
 word, arg = word.split(/=/, 2)
 argpat = Completion.regexp(arg, false) if arg and !arg.empty?
 long = true
 when /\A-/
 short = true
 end
 pat = Completion.regexp(word, long)
 visit(:each_option) do |opt|
 next unless Switch === opt
 opts = (long ? opt.long : []) + (short ? opt.short : [])
 opts = Completion.candidate(word, true, pat, &opts.method(:each)).map(&:first) if pat
 if /\A=/ =~ opt.arg
 opts.map! {|sw| sw + "="}
 if arg and CompletingHash === opt.pattern
 if opts = opt.pattern.candidate(arg, false, argpat)
 opts.map!(&:last)
 end
 end
 end
 list.concat(opts)
 end
 list
 end

AltStyle によって変換されたページ (->オリジナル) /