class Rubinius::Debugger::Command::ShowVariable

Public Instance Methods

run(args) click to toggle source
# File lib/rubinius/debugger/commands.rb, line 619
def run(args)
  if !args or args.strip.empty?
    variables.each do |name, val|
      info "var '#{name}' = #{val.inspect}"
    end

    if @debugger.user_variables > 0
      section "User variables"
      (0...@debugger.user_variables).each do |i|
        str = "$d#{i}"
        val = Rubinius::Globals[str.to_sym]
        info "var #{str} = #{val.inspect}"
      end
    end
  else
    var = args.strip.to_sym
    if variables.key?(var)
      info "var '#{var}' = #{variables[var].inspect}"
    else
      error "No variable set named '#{var}'"
    end
  end

end