class
Cradare2::Plugin::Router
- Cradare2::Plugin::Router
- Reference
- Object
Overview
Router for mounting multiple command dispatchers or sub-suites under different prefixes. Enables building modular composite plugins (e.g. mounting both "godot" and "lapis" suites) while providing unified command dispatching and help menus.
Defined in:
cradare2/plugin/router.crConstructors
Instance Method Summary
- #client : Client
- #default_prefix : String | Nil
- #default_prefix=(default_prefix : String | Nil)
-
#dispatch(args : Array(String)) : String
Dispatches an array of command arguments.
-
#dispatch(cmd_line : String) : String
Dispatches a command string to the appropriate mounted prefix dispatcher.
-
#help : String
Unified help menu aggregating all mounted command suites.
-
#mount(prefix : String, dispatcher : CommandDispatcher) : self
Mounts a CommandDispatcher under a specific prefix.
-
#mount(prefix : String, &block : CommandDispatcher -> Nil) : self
Mounts and creates a new CommandDispatcher for prefix yielding it to a block.
- #routes : Hash(String, CommandDispatcher)
Constructor Detail
Instance Method Detail
def dispatch(cmd_line : String) : String
#
Dispatches a command string to the appropriate mounted prefix dispatcher.
Mounts a CommandDispatcher under a specific prefix.
Mounts and creates a new CommandDispatcher for prefix yielding it to a block.