    # File lib/rbot/maskdb.rb, line 12
          def add(val, *prefs)
            str = prefs.shift or raise 'empty prefs'
            @pre = str.dup if @chi.empty?

            n = 0
            @pre.size.times do
              break if @pre[n] != str[n]
              n += 1
            end

            rest = str.slice(n .. -1)

            if n != @pre.size
              prest = @pre.slice!(n .. -1)
              pc = prest.slice! 0
              @chi = {pc => Tree.new(prest, @chi)}
            end

            c = rest.slice!(0)

            if c
              (@chi[c] ||= Tree.new).add(val, rest, *prefs)
            else
              if prefs.empty?
                (@chi[''] ||= Array.new).push val
              else
                (@chi[''] ||= Tree.new).add(val, *prefs)
              end
            end
          end