Class: OptionParser::CompletingHash

Inherits:
Hash
  • Object
show all
Includes:
Completion
Defined in:
lib/MrMurano/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

#deep_merge!, #deep_symbolize_keys, #deep_symbolize_keys!, #deep_transform_keys, #deep_transform_keys!, flat_hash, nested_keys, transform_keys_to_strings, transform_keys_to_symbols

Instance Method Details

#match(key) ⇒ Object

Completion for hash key.



927
928
929
930
931
932
# File 'lib/MrMurano/optparse.rb', line 927

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