Class: Meshchat::Ui::Display::Manager
- Inherits:
-
Object
- Object
- Meshchat::Ui::Display::Manager
- Defined in:
- lib/meshchat/ui/display/manager.rb
Instance Attribute Summary collapse
-
#_logger ⇒ Object
Returns the value of attribute _logger.
-
#_ui ⇒ Object
Returns the value of attribute _ui.
Instance Method Summary collapse
-
#initialize(ui_klass) ⇒ Manager
constructor
A new instance of Manager.
- #notify(*args) ⇒ Object
- #present_message(message) ⇒ Object
Constructor Details
#initialize(ui_klass) ⇒ Manager
Returns a new instance of Manager.
23 24 25 26 |
# File 'lib/meshchat/ui/display/manager.rb', line 23 def initialize(ui_klass) self._logger = Logger.new('debug.log') self._ui = ui_klass.new end |
Instance Attribute Details
#_logger ⇒ Object
Returns the value of attribute _logger.
18 19 20 |
# File 'lib/meshchat/ui/display/manager.rb', line 18 def _logger @_logger end |
#_ui ⇒ Object
Returns the value of attribute _ui.
6 7 8 |
# File 'lib/meshchat/ui/display/manager.rb', line 6 def _ui @_ui end |
Instance Method Details
#notify(*args) ⇒ Object
53 54 55 |
# File 'lib/meshchat/ui/display/manager.rb', line 53 def notify(*args) Notify.show(*args) if defined? Notify and Notify end |
#present_message(message) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/meshchat/ui/display/manager.rb', line 28 def () result = .handle return unless result case .class.name when Network::Message::Chat.name chat result notify(summary: .sender_name, body: .) when Network::Message::Whisper.name whisper result notify(summary: .sender_name, body: .) when Network::Message::Emote.name emote result notify(summary: .sender_name, body: .) when Network::Message::PingReply.name, Network::Message::Ping.name info result when Network::Message::NodeList.name, Network::Message::NodeListDiff.name, Network::Message::NodeListHash.name # display nothing else add_line result end end |