class Byebug::VarCommand::ConstCommand
Shows constants
def self.description
def self.description <<-EOD v[ar] c[onstant] #{short_description} EOD end
def self.regexp
def self.regexp /^\s* c(?:onst)? (?:\s+ (.+))? \s*$/x end
def self.short_description
def self.short_description 'Shows constants of an object.' end
def execute
def execute obj = warning_eval(str_obj) unless obj.is_a?(Module) return errmsg(pr('variable.errors.not_module', object: str_obj)) end constants = warning_eval("#{str_obj}.constants") puts prv(constants.sort.map { |c| [c, obj.const_get(c)] }, 'constant') end
def str_obj
def str_obj @str_obj ||= @match[1] || 'self.class' end