类 DEBUGGER__::AbbrevCommand::TrieNode

公共类方法

new() 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 5
def initialize
  @children = {}
  @types = {} # set
end

公共实例方法

[](c) 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 15
def [](c)
  @children[c]
end
add_type(type) 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 19
def add_type type
  @types[type] = true
  self
end
append(c, type) 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 10
def append c, type
  trie = (@children[c] ||= TrieNode.new)
  trie.add_type type
end
candidates() 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 36
def candidates
  @children.map{|c, n|
    ss = n.candidates
    ss.empty? ? c :
    ss.map{|s|
      c+s
    }
  }.flatten
end
type() 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 28
def type
  if @types.size == 1
    @types.keys.first
  else
    nil
  end
end
types() 点击切换源码
# File debug-1.10.0/lib/debug/abbrev_command.rb, line 24
def types
  @types.keys
end