File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 11require 'objspace'
22require 'pp'
3- require 'irb/color'
3+ require "irb/color_printer"
4+
45require_relative 'frame_info'
56
67module DEBUGGER__
@@ -22,6 +23,10 @@ def colorize str, color
2223 end
2324 end
2425
26+ def colored_inspect ( obj )
27+ IRB ::ColorPrinter . pp ( obj , "" )
28+ end
29+
2530 def colorize_blue ( str )
2631 colorize ( str , [ :BLUE , :BOLD ] )
2732 end
@@ -288,22 +293,24 @@ def show_by_editor path = nil
288293
289294 def show_locals
290295 if s = current_frame &.self
291- puts " %self => #{ s } "
296+ puts " %self => #{ colored_inspect ( s ) } "
292297 end
293298 if current_frame &.has_return_value
294- puts " %return => #{ current_frame . return_value } "
299+ puts " %return => #{ colored_inspect ( current_frame . return_value ) } "
295300 end
296301 if b = current_frame &.binding
297302 b . local_variables . each { |loc |
298- puts " #{ loc } => #{ b . local_variable_get ( loc ) . inspect } "
303+ value = b . local_variable_get ( loc )
304+ puts " #{ loc } => #{ colored_inspect ( value ) } "
299305 }
300306 end
301307 end
302308
303309 def show_ivars
304310 if s = current_frame &.self
305311 s . instance_variables . each { |iv |
306- puts " #{ iv } => #{ s . instance_variable_get ( iv ) } "
312+ value = s . instance_variable_get ( iv )
313+ puts " #{ iv } => #{ colored_inspect ( value ) } "
307314 }
308315 end
309316 end
You can’t perform that action at this time.
0 commit comments