# OptionParser::Completion (Module)

In: | optparse.rb

## Methods

complete convert ignore_case?

## Public Instance methods

complete(key, pat = nil) {|key, *sw| ...}

[Source]

    # File optparse.rb, line 179
        def complete(key, pat = nil)
          pat ||= Regexp.new('\A' + Regexp.quote(key).gsub(/\w+(?=.)/, '\&\w*'),
                             ignore_case?)
          canon, sw, k, v, cn = nil
          candidates = []
          each do |k, *v|
            (if Regexp === k
               kn = nil
               k === key
             else
               kn = defined?(k.id2name) ? k.id2name : k
               pat === kn
             end) or next
            v << k if v.empty?
            candidates << [k, v, kn]
          end
          candidates = candidates.sort_by {|k, v, kn| kn.size}
          if candidates.size == 1
            canon, sw, * = candidates[0]
          elsif candidates.size > 1
            canon, sw, cn = candidates.shift
            candidates.each do |k, v, kn|
              next if sw == v
              if String === cn and String === kn
                if cn.rindex(kn, 0)
                  canon, sw, cn = k, v, kn
                  next
                elsif kn.rindex(cn, 0)
                  next
                end
              end
              throw :ambiguous, key
            end
          end
          if canon
            block_given? or return key, *sw
            yield(key, *sw)
          end
        end

convert(opt = nil, val = nil, *)

[Source]

    # File optparse.rb, line 224
        def convert(opt = nil, val = nil, *)
          val
        end

ignore_case?()

[Source]

    # File optparse.rb, line 228
        def ignore_case?
          false
        end

[Validate]