Module: Debugger::VarFunctions

Defined in:
lib/ruby-debug/commands/variables.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#var_class_selfObject



21
22
23
24
# File 'lib/ruby-debug/commands/variables.rb', line 21

def var_class_self
  obj = debug_eval('self')
  var_list(obj.class.class_variables, get_binding)
end

#var_list(ary, b = get_binding) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby-debug/commands/variables.rb', line 3

def var_list(ary, b = get_binding)
  ary.sort!
  for v in ary
    begin
      s = debug_eval(v.to_s, b).inspect
    rescue
      begin
        s = debug_eval(v.to_s, b).to_s
      rescue
        s = "*Error in evaluation*"
      end
    end
    if s.size > self.class.settings[:width]
      s[self.class.settings[:width]-3 .. -1] = "..."
    end
    print "%s = %s\n", v, s
  end
end