class DTK::Shell::MessageQueue
Constants
- MESSAGE_TYPES
Public Class Methods
new()
click to toggle source
# File lib/shell/message_queue.rb, line 29 def initialize @queue = {} init_or_clear() end
print_messages()
click to toggle source
# File lib/shell/message_queue.rb, line 38 def self.print_messages() self.instance.print_messages() end
process_response(response_obj)
click to toggle source
# File lib/shell/message_queue.rb, line 34 def self.process_response(response_obj) self.instance.process_response(response_obj) end
Public Instance Methods
init_or_clear()
click to toggle source
# File lib/shell/message_queue.rb, line 42 def init_or_clear() MESSAGE_TYPES.each { |msg_type| @queue[msg_type] = [] } end
print_messages()
click to toggle source
# File lib/shell/message_queue.rb, line 46 def print_messages() @queue[:info].each { |msg| DTK::Client::OsUtil.print(msg, :white) } @queue[:warn].each { |msg| DTK::Client::OsUtil.print(msg, :yellow) } @queue[:error].each { |msg| DTK::Client::OsUtil.print(msg, :red) } init_or_clear() end
process_response(response_obj)
click to toggle source
# File lib/shell/message_queue.rb, line 54 def process_response(response_obj) MESSAGE_TYPES.each do |msg_type| msg = response_obj[msg_type.to_s] || response_obj[msg_type] @queue[msg_type] << msg if msg end end