Class: RubyLsp::TypeGuessr::DebugServer
- Inherits:
-
Object
- Object
- RubyLsp::TypeGuessr::DebugServer
- Defined in:
- lib/ruby_lsp/type_guessr/debug_server.rb
Overview
Debug web server for inspecting TypeGuessr index data Only runs when debug mode is enabled Provides search and IR graph visualization
Constant Summary collapse
- DEFAULT_PORT =
7010
Instance Method Summary collapse
-
#initialize(global_state, runtime_adapter, port: DEFAULT_PORT) ⇒ DebugServer
constructor
A new instance of DebugServer.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(global_state, runtime_adapter, port: DEFAULT_PORT) ⇒ DebugServer
Returns a new instance of DebugServer.
16 17 18 19 20 21 22 23 24 |
# File 'lib/ruby_lsp/type_guessr/debug_server.rb', line 16 def initialize(global_state, runtime_adapter, port: DEFAULT_PORT) @global_state = global_state @runtime_adapter = runtime_adapter @graph_builder = DebugGraphBuilder.new(runtime_adapter) @port = port @server = nil @thread = nil @running = false end |
Instance Method Details
#start ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ruby_lsp/type_guessr/debug_server.rb', line 26 def start return if @running @running = true @thread = Thread.new { run_server } end |
#stop ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/ruby_lsp/type_guessr/debug_server.rb', line 33 def stop @running = false @server&.close @thread&.kill @thread = nil @server = nil end |