class Byebug::VarCommand::ConstCommand
Shows constants
Public Class Methods
description()
click to toggle source
# File lib/byebug/commands/var/const.rb, line 21 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 17 def self.regexp /^\s* c(?:onst)? (?:\s+ (.+))? \s*$/x end
short_description()
click to toggle source
# File lib/byebug/commands/var/const.rb, line 29 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 33 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 43 def str_obj @str_obj ||= @match[1] || "self.class" end