Module: Lich::Common::ShutdownIntent
- Defined in:
- documented/common/shutdown_intent.rb
Overview
Detects explicit frontend shutdown commands.
Constant Summary collapse
- USER_EXIT_COMMAND =
Regexp pattern that matches frontend shutdown commands.
Matches "exit" or "quit" (case-insensitive) with optional whitespace, optionally preceded by a
<c>XML tag marker. Anchored to match the entire string. /\A\s*(?:<c>)?\s*(?:exit|quit)\s*\z/i
Class Method Summary collapse
-
.user_exit_command?(client_string) ⇒ Boolean
Detects whether a client string is an explicit frontend shutdown command.
Class Method Details
.user_exit_command?(client_string) ⇒ Boolean
Detects whether a client string is an explicit frontend shutdown command.
Returns true if the string matches an exit or quit command, false otherwise. Safely handles nil input by returning false.
36 37 38 39 40 |
# File 'documented/common/shutdown_intent.rb', line 36 def self.user_exit_command?(client_string) return false if client_string.nil? USER_EXIT_COMMAND.match?(client_string.to_s) end |