Class: Rubinius::Debugger::Command::ShowVariable

Inherits:
Rubinius::Debugger::Command show all
Defined in:
lib/rubinius/debugger/commands.rb

Instance Method Summary collapse

Methods inherited from Rubinius::Debugger::Command

commands, #current_frame, #current_method, descriptor, ext_help, help, #initialize, #listen, match?, pattern, #run_code, #variables

Methods included from Display

#ask, #crit, #display, #error, #info, #section

Constructor Details

This class inherits a constructor from Rubinius::Debugger::Command

Instance Method Details

#run(args) ⇒ Object



619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
# 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