class Byebug::VarConstantCommand


Show constants and its values.

def description

def description
  %(v[ar] co[nst] <object>        Show constants of <object>.)
end

def execute

def execute
  obj = bb_eval(@match.post_match)
  if obj.is_a? Module
    constants = bb_eval("#{@match.post_match}.constants")
    constants.sort!
    constants.each do |c|
      value = obj.const_get(c)
      puts format(' %s => %p', c, value)
    end
  else
    puts "Should be Class/Module: #{@match.post_match}"
  end
end

def names

def names
  %w(var)
end

def regexp

def regexp
  /^\s* v(?:ar)? \s+ co(?:nst(?:ant)?)? \s+/x
end