Class: Rubinius::Debugger::Command::SetVariable

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



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# File 'lib/rubinius/debugger/commands.rb', line 585

def run(args)
  var, val = args.split(/\s+/, 2)

  if val
    case val.strip
    when "true", "on", "yes", ""
      val = true
    when "false", "off", "no"
      val = false
    when "nil"
      val = nil
    when /\d+/
      val = val.to_i
    end
  else
    val = true
  end

  info "Set '#{var}' = #{val.inspect}"

  @debugger.variables[var.to_sym] = val
end