Sha256: 374bbd17d06b4338018f270a7797e876ead532a9b428f0976871dbebde257165
Contents?: true
Size: 837 Bytes
Versions: 2
Compression:
Stored size: 837 Bytes
Contents
module Byebug # # Reopens the +var+ command to define the +const+ subcommand # class VarCommand < Command # # Shows constants # class ConstSubcommand < Command def regexp /^\s* c(?:onst)? (?:\s+ (.+))? \s*$/x end 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 short_description 'Shows constants of an object.' end def description <<-EOD v[ar] c[onstant] #{short_description} EOD end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
sc_core-0.0.7 | test/dummy/vendor/bundle/ruby/2.2.0/gems/byebug-5.0.0/lib/byebug/commands/var/const.rb |
byebug-5.0.0 | lib/byebug/commands/var/const.rb |