class DEBUGGER__::AbbrevCommand
Public Class Methods
Source
# File bundled-src/debug-1.11.1/lib/debug/abbrev_command.rb, line 48 def initialize config @trie = TrieNode.new build config end
config: { type: [commands…], … }
Public Instance Methods
Source
# File bundled-src/debug-1.11.1/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
Private Instance Methods
Source
# File bundled-src/debug-1.11.1/lib/debug/abbrev_command.rb, line 53 def build config config.each do |type, commands| commands.each do |command| trie = @trie command.each_char do |c| trie = trie.append(c, type) end end end end