class Meshchat::Ui::Command::Base
Constants
- ADD
- ALL_CHAT_LOCK
- BIND
- CHAT
- CONFIG
- DISPLAY
- EMOTE
- EXIT
- EXPORT
- HELP
- IDENTITY
- IMPORT
- IRB
- OFFLINE
- ONLINE
- PING
- PING_ALL
- QUIT
- REMOVE
- RM
- ROLL
- SEND_DISCONNECT
- SERVER
- SERVERS
- SET
Commands
- SHARE
- WHISPER_LOCK
- WHO
Attributes
_input[R]
_input_factory[R]
_message_dispatcher[R]
_message_factory[R]
Public Class Methods
new(input, message_dispatcher, message_factory, input_factory)
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 39 def initialize(input, message_dispatcher, message_factory, input_factory) @_input = input&.chomp @_message_dispatcher = message_dispatcher @_message_factory = message_factory @_input_factory = input_factory end
Public Instance Methods
handle()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 46 def handle klass = COMMAND_MAP[command] Display.debug("INPUT: #{klass&.name} from #{command} derived from #{_input}") if klass _input_factory.create(for_input: _input, with_class: klass).handle else Display.alert "#{command} not implemented..." end end
Protected Instance Methods
command()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 66 def command @command ||= command_args.first end
command_args()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 62 def command_args @command_args ||= command_string.split(' ') end
command_string()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 58 def command_string @command_string ||= _input[1, _input.length] end
sub_command()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 74 def sub_command @sub_command ||= command_args[1] end
sub_command_args()
click to toggle source
# File lib/meshchat/ui/command/base.rb, line 70 def sub_command_args @sub_command_args ||= command_args[2..3] end