Class: Meshchat::Ui::Command::Base
- Inherits:
-
Object
- Object
- Meshchat::Ui::Command::Base
- Defined in:
- lib/meshchat/ui/command/base.rb
Direct Known Subclasses
AllChatLock, Bind, Chat, Config, Exit, Help, Identity, Import, Irb, Offline, Online, Ping, PingAll, SendDisconnect, Server, Share, Whisper, WhisperLock
Constant Summary collapse
- SET =
Commands
'set'
- CONFIG =
'config'
- DISPLAY =
'display'
- EXIT =
'exit'
- QUIT =
'quit'
- CHAT =
'chat'
- ADD =
'add'
- REMOVE =
'remove'
- RM =
'rm'
- SERVERS =
'servers'
- SERVER =
'server'
- WHO =
'who'
- PING =
'ping'
- PING_ALL =
'pingall'
- IDENTITY =
'identity'
- IRB =
'c'
- SHARE =
'share'
- IMPORT =
'import'
- EXPORT =
'export'
- ONLINE =
'online'
- OFFLINE =
'offline'
- HELP =
'help'
- BIND =
'bind'
- SEND_DISCONNECT =
'senddisconnect'
- EMOTE =
'me'
- ROLL =
'roll'
- WHISPER_LOCK =
'wl'
- ALL_CHAT_LOCK =
'all'
Instance Attribute Summary collapse
-
#_input ⇒ Object
readonly
Returns the value of attribute _input.
-
#_input_factory ⇒ Object
readonly
Returns the value of attribute _input_factory.
-
#_message_dispatcher ⇒ Object
readonly
Returns the value of attribute _message_dispatcher.
-
#_message_factory ⇒ Object
readonly
Returns the value of attribute _message_factory.
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(input, message_dispatcher, message_factory, input_factory) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(input, message_dispatcher, message_factory, input_factory) ⇒ Base
Returns a new instance of Base.
39 40 41 42 43 44 |
# File 'lib/meshchat/ui/command/base.rb', line 39 def initialize(input, , , input_factory) @_input = input&.chomp @_message_dispatcher = @_message_factory = @_input_factory = input_factory end |
Instance Attribute Details
#_input ⇒ Object (readonly)
Returns the value of attribute _input.
36 37 38 |
# File 'lib/meshchat/ui/command/base.rb', line 36 def _input @_input end |
#_input_factory ⇒ Object (readonly)
Returns the value of attribute _input_factory.
37 38 39 |
# File 'lib/meshchat/ui/command/base.rb', line 37 def _input_factory @_input_factory end |
#_message_dispatcher ⇒ Object (readonly)
Returns the value of attribute _message_dispatcher.
36 37 38 |
# File 'lib/meshchat/ui/command/base.rb', line 36 def @_message_dispatcher end |
#_message_factory ⇒ Object (readonly)
Returns the value of attribute _message_factory.
37 38 39 |
# File 'lib/meshchat/ui/command/base.rb', line 37 def @_message_factory end |
Instance Method Details
#handle ⇒ Object
46 47 48 49 50 51 52 53 54 |
# 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 |