lib/ruby-debug/commands/variables.rb in ruby-debug-ide-0.1.6 vs lib/ruby-debug/commands/variables.rb in ruby-debug-ide-0.1.7

- old
+ new

@@ -72,12 +72,25 @@ if (obj.is_a?(Array)) then print_array(obj) elsif (obj.is_a?(Hash)) then print_hash(obj) else - b = obj.instance_eval{binding()} - print_variables(obj.instance_variables, 'instance') do |var| - debug_eval(var, b) + print_element("variables") do + # instance variables + kind = 'instance' + inst_vars = obj.instance_variables + instance_binding = obj.instance_eval{binding()} + # print self at top position + print_variable('self', debug_eval('self', instance_binding), kind) if inst_vars.include?('self') + inst_vars.sort.each do |var| + print_variable(var, debug_eval(var, instance_binding), kind) unless var == 'self' + end + + # class variables + class_binding = obj.class.class_eval('binding()') + obj.class.class_variables.sort.each do |var| + print_variable(var, debug_eval(var, class_binding), 'class') + end end end end class << self