Class: Meshchat::Ui::Command::Chat

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

Direct Known Subclasses

Emote, Roll

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

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#handleObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/meshchat/ui/command/chat.rb', line 6

def handle
  servers = Node.online
  if !servers.empty?
    type = self.class.name.demodulize.downcase
    m = _message_factory.create(type, data: { message: _input })
    show_myself(m)

    servers.each do |entry|
      _message_dispatcher.send_message(node: entry, message: m)
    end
  else
    Display.warning 'you have no servers'
  end
end

#show_myself(message) ⇒ Object



21
22
23
# File 'lib/meshchat/ui/command/chat.rb', line 21

def show_myself(message)
  Display.chat message.display
end