class Byebug::VarCommand::ConstSubcommand


Shows constants

def description

def description
  <<-EOD
    v[ar] c[onstant]
    #{short_description}
  EOD
end

def execute

def execute
  str_obj = @match[1] || 'self.class'
  obj = bb_warning_eval(str_obj)
  unless obj.is_a?(Module)
    return errmsg(pr('variable.errors.not_module', object: str_obj))
  end
  constants = bb_eval("#{str_obj}.constants")
  puts prv(constants.sort.map { |c| [c, obj.const_get(c)] }, 'constant')
end

def regexp

def regexp
  /^\s* c(?:onst)? (?:\s+ (.+))? \s*$/x
end

def short_description

def short_description
  'Shows constants of an object.'
end