Class: Lich::Common::UpstreamHook Private
- Inherits:
-
Object
- Object
- Lich::Common::UpstreamHook
- Extended by:
- HookRegistry
- Defined in:
- documented/common/upstreamhook.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Registry for hooks that intercept and transform text flowing from the game server to the client.
Upstream hooks receive each line of unprocessed server output and may modify or suppress it. Script-scoped hooks are automatically removed when a script dies; persistent hooks remain active.
Class Method Summary collapse
-
._hook_owners ⇒ Hash
private
Returns the registry of script owners for upstream hooks.
-
._hook_persist ⇒ Hash
private
Returns the registry of persistence flags for upstream hooks.
-
._hook_sources ⇒ Hash
private
Returns the registry of script sources for upstream hooks.
-
._hooks ⇒ Object
private
Per-class storage for the shared HookRegistry methods.
-
.run(client_string) ⇒ String?
private
Invokes all registered upstream hooks in sequence to transform server output.
Methods included from HookRegistry
add, cleanup_on_death, hook_sources, list, remove, sources
Class Method Details
._hook_owners ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the registry of script owners for upstream hooks.
42 43 44 |
# File 'documented/common/upstreamhook.rb', line 42 def self._hook_owners @@upstream_hook_owners end |
._hook_persist ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the registry of persistence flags for upstream hooks.
50 51 52 |
# File 'documented/common/upstreamhook.rb', line 50 def self._hook_persist @@upstream_hook_persist end |
._hook_sources ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the registry of script sources for upstream hooks.
34 35 36 |
# File 'documented/common/upstreamhook.rb', line 34 def self._hook_sources @@upstream_hook_sources end |
._hooks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Per-class storage for the shared HookRegistry methods.
26 27 28 |
# File 'documented/common/upstreamhook.rb', line 26 def self._hooks @@upstream_hooks end |
.run(client_string) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Invokes all registered upstream hooks in sequence to transform server output.
Each hook receives the client string and may modify or return nil to suppress it. If a hook raises an error, it is removed from the registry, an error message is sent, and processing stops.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'documented/common/upstreamhook.rb', line 63 def self.run(client_string) for key in @@upstream_hooks.keys begin client_string = @@upstream_hooks[key].call(client_string) rescue @@upstream_hooks.delete(key) respond "--- Lich: UpstreamHook: #{$!}" respond $!.backtrace.first end return nil if client_string.nil? end return client_string end |