Sha256: 4173dbcf9969d07feba9331496ac90611fa16d9b55a2c513c44162b7c69de154

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011 Rocky Bernstein <rockyb@rubyforge.net>
require_relative 'locals'

class Trepan::Subcommand::InfoVariablesConstant < 
    Trepan::Subcommand::InfoVariablesLocals
  Trepan::Util.suppress_warnings {
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP         = <<-EOH
#{CMD}
#{CMD} [names]

Show class constants of the current stack frame.
Normally for each which show both the name and value. If you just
want a list of names add parameter 'names'.
EOH
    SHORT_HELP   = 'Show class constants via the current stack frame'
    MIN_ABBREV   = 'co'.size
    MIN_ARGS     = 0
    MAX_ARGS     = 1
    NEED_STACK   = true
  }

  def get_names
    @proc.debug_eval_no_errmsg('self.class.constants.sort') || []
  end

  def run(args)
    run_for_type(args, 'constant', @proc.debug_eval('self'))
  end
end

if __FILE__ == $0
  # Demo it.
  require_relative '../../mock'
  cmd = 
    MockDebugger::subsub_setup(Trepan::Subcommand::InfoVariables,
                               Trepan::Subcommand::InfoVariablesConstant)
  cmd.run(cmd.prefix)
  cmd.run(cmd.prefix + ['name'])
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trepanning-1.93.35 processor/command/info_subcmd/variables_subcmd/constant.rb
trepanning-1.93.32 processor/command/info_subcmd/variables_subcmd/constant.rb
trepanning-0.1.6 processor/command/info_subcmd/variables_subcmd/constant.rb
trepanning-0.1.4 processor/command/info_subcmd/variables_subcmd/constant.rb