Class: Meshchat::Ui::Command::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/meshchat/ui/command/config.rb

Constant Summary

Constants inherited from Base

Base::ADD, Base::ALL_CHAT_LOCK, Base::BIND, Base::CHAT, Base::CONFIG, Base::DISPLAY, Base::EMOTE, Base::EXIT, Base::EXPORT, Base::HELP, Base::IDENTITY, Base::IMPORT, Base::IRB, Base::OFFLINE, Base::ONLINE, Base::PING, Base::PING_ALL, Base::QUIT, Base::REMOVE, Base::RM, Base::ROLL, Base::SEND_DISCONNECT, Base::SERVER, Base::SERVERS, Base::SET, Base::SHARE, Base::WHISPER_LOCK, Base::WHO

Instance Attribute Summary

Attributes inherited from Base

#_input, #_input_factory, #_message_dispatcher, #_message_factory

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Meshchat::Ui::Command::Base

Class Method Details

.descriptionObject



6
7
8
# File 'lib/meshchat/ui/command/config.rb', line 6

def self.description
  'interface for setting and displaying various config options'
end

Instance Method Details

#config_set_argsObject



27
28
29
# File 'lib/meshchat/ui/command/config.rb', line 27

def config_set_args
  command_args[2..3]
end

#handleObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/meshchat/ui/command/config.rb', line 10

def handle
  case sub_command
  when SET
    if is_valid_set_command?
      key, value = config_set_args

      Display.info APP_CONFIG.user.set(key, with: value)
    else
      Display.alert 'set requires a key and a value'
    end
  when DISPLAY
    Display.info APP_CONFIG.user.display
  else
    Display.alert 'config command not implemented...'
  end
end

#is_valid_set_command?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/meshchat/ui/command/config.rb', line 31

def is_valid_set_command?
  sub_command == SET && command_args.length == 4
end