Class: Debugger::PPCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/ruby-debug/commands/eval.rb

Overview

:nodoc:

Constant Summary

Constants inherited from Command

Command::DEF_OPTIONS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options

Constructor Details

This class inherits a constructor from Debugger::Command

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



57
58
59
60
61
# File 'lib/ruby-debug/commands/eval.rb', line 57

def help(cmd)
  %{
    pp expression\tevaluate expression and print its value
  }
end

.help_commandObject



53
54
55
# File 'lib/ruby-debug/commands/eval.rb', line 53

def help_command
  'pp'
end

Instance Method Details

#executeObject



45
46
47
48
49
50
# File 'lib/ruby-debug/commands/eval.rb', line 45

def execute
  exp = @match.post_match
  out = StringIO.new
  PP.pp(debug_eval(exp), out) rescue out.puts $!.message
  print_pp out.string
end

#regexpObject



41
42
43
# File 'lib/ruby-debug/commands/eval.rb', line 41

def regexp
  /^\s*pp\s+/
end