Class: DEBUGGER__::AbbrevCommand
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | lib/debug/abbrev_command.rb |
Class Method Summary
-
.new(config) ⇒ AbbrevCommand
constructor
config: { type: [commands…], …
Instance Method Summary
Constructor Details
.new(config) ⇒ AbbrevCommand
config: { type: [commands…], … }
Instance Method Details
#build(config) (private)
[ GitHub ]#search(str, if_none = nil) {|trie.candidates.map{|s| str + s}| ... }
# File 'lib/debug/abbrev_command.rb', line 64
def search str, if_none = nil trie = @trie str.each_char do |c| if trie = trie[c] return trie.type if trie.type else return if_none end end yield trie.candidates.map{|s| str + s} if block_given? if_none end