# class Byebug::VarCommand::ConstCommand

Shows constants

### Public Class Methods

description() click to toggle source

    # File lib/byebug/commands/var/const.rb, line 22
          def self.description
            <<-DESCRIPTION
              v[ar] c[onstant]

              #{short_description}
            DESCRIPTION
          end

regexp() click to toggle source

    # File lib/byebug/commands/var/const.rb, line 18
    def self.regexp
      /^\s* c(?:onst)? (?:\s+ (.+))? \s*$/x
    end

short_description() click to toggle source

    # File lib/byebug/commands/var/const.rb, line 30
    def self.short_description
      "Shows constants of an object."
    end

### Public Instance Methods

execute() click to toggle source

    # File lib/byebug/commands/var/const.rb, line 34
    def execute
      obj = warning_eval(str_obj)
      return errmsg(pr("variable.errors.not_module", object: str_obj)) unless obj.is_a?(Module)

      constants = warning_eval("#{str_obj}.constants")
      puts prv(constants.sort.map { |c| [c, obj.const_get(c)] }, "constant")
    end

### Private Instance Methods

str_obj() click to toggle source

    # File lib/byebug/commands/var/const.rb, line 44
    def str_obj
      @str_obj ||= @match[1] || "self.class"
    end