Module: DebugServer::Console

Included in:
Session
Defined in:
lib/debugserver/console.rb

Instance Method Summary collapse

Instance Method Details



10
11
12
13
# File 'lib/debugserver/console.rb', line 10

def print_dump(content, name=nil)
  puts "========== #{name} ==========".magenta unless name.nil?
  puts "#{content}\n"
end


3
4
5
6
7
8
# File 'lib/debugserver/console.rb', line 3

def print_string(content, level=nil)
  unless level.nil?
    content = content.send(COLORS[level]) if COLORS.include?(level)
  end
  puts content
end

#process_output(packet) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/debugserver/console.rb', line 15

def process_output(packet)
  case packet['method']
    when METHOD_CLEAR
      system('clear')
    when METHOD_MESSAGE
      print_string(packet['content']['message'], packet['content']['level'])
    when METHOD_DUMP
      print_dump(packet['content']['object'], packet['content']['name'])
  end
end