Class: OptionParser::CompletingHash

Inherits:
Hash show all
Includes:
Completion
Defined in:
opal/stdlib/optparse.rb

Overview

Hash with completion search feature. See OptionParser::Completion.

Instance Method Summary collapse

Methods included from Completion

candidate, #candidate, #complete, #convert, regexp

Methods inherited from Hash

#_initialize, #initialize, #pretty_print, #pretty_print_cycle, #ruby2_keywords_hash, #ruby2_keywords_hash?, #to_json, #to_n

Constructor Details

This class inherits a constructor from Hash

Instance Method Details

#match(key) ⇒ Object

Completion for hash key.



936
937
938
939
940
941
# File 'opal/stdlib/optparse.rb', line 936

def match(key)
  *values = fetch(key) do
    raise AmbiguousArgument, catch(:ambiguous) { return complete(key) }
  end
  [key, *values]
end