Class: RubynCode::IDE::Handlers::ShutdownHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyn_code/ide/handlers/shutdown_handler.rb

Overview

Handles the “shutdown” JSON-RPC request.

Triggers session persistence, signals the server to stop its read loop, and returns confirmation.

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ ShutdownHandler

Returns a new instance of ShutdownHandler.



11
12
13
# File 'lib/rubyn_code/ide/handlers/shutdown_handler.rb', line 11

def initialize(server)
  @server = server
end

Instance Method Details

#call(_params) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/rubyn_code/ide/handlers/shutdown_handler.rb', line 15

def call(_params)
  warn '[ShutdownHandler] shutdown requested'

  save_session!
  @server.stop!

  { 'shutdown' => true }
end