Module: Byebug::VarFunctions

Defined in:
lib/byebug/commands/variables.rb

Instance Method Summary collapse

Instance Method Details

#var_class_selfObject



20
21
22
23
# File 'lib/byebug/commands/variables.rb', line 20

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

#var_globalObject



24
25
26
# File 'lib/byebug/commands/variables.rb', line 24

def var_global
  var_list(global_variables.reject { |v| [:$=, :$KCODE, :$-K].include?(v) })
end

#var_list(ary, b = get_binding) ⇒ Object



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

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
    pad_with_dots(s)
    print "%s = %s\n", v, s
  end
end