class DEBUGGER__::AbbrevCommand
def build config
def build config .each do |type, commands| ands.each do |command| ie = @trie mmand.each_char do |c| trie = trie.append(c, type) d
def initialize config
def initialize config @trie = TrieNode.new build config end
def search str, if_none = nil
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