403Webshell
Server IP : 217.160.0.244  /  Your IP : 216.73.216.36
Web Server : Apache
System : Linux infong-eu155 4.4.400-icpu-108 #2 SMP Wed Feb 11 11:51:01 UTC 2026 x86_64
User : u100174116 ( 6746176)
PHP Version : 8.5.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/ruby/gems/3.3.0/gems/debug-1.9.2/lib/debug/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/ruby/gems/3.3.0/gems/debug-1.9.2/lib/debug//abbrev_command.rb
module DEBUGGER__
  class AbbrevCommand
    class TrieNode
      def initialize
        @children = {}
        @types = {} # set
      end

      def append c, type
        trie = (@children[c] ||= TrieNode.new)
        trie.add_type type
      end

      def [](c)
        @children[c]
      end

      def add_type type
        @types[type] = true
        self
      end

      def types
        @types.keys
      end

      def type
        if @types.size == 1
          @types.keys.first
        else
          nil
        end
      end

      def candidates
        @children.map{|c, n|
          ss = n.candidates
          ss.empty? ? c :
          ss.map{|s|
            c+s
          }
        }.flatten
      end
    end

    # config: { type: [commands...], ... }
    def initialize config
      @trie = TrieNode.new
      build config
    end

    private 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

    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
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit