Class: Byebug::PPCommand

Inherits:
Command show all
Defined in:
lib/byebug/commands/eval.rb

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, #print_subcmds, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.help(cmd) ⇒ Object



98
99
100
101
102
# File 'lib/byebug/commands/eval.rb', line 98

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

.help_commandObject



94
95
96
# File 'lib/byebug/commands/eval.rb', line 94

def help_command
  'pp'
end

Instance Method Details

#executeObject



83
84
85
86
87
88
89
90
91
# File 'lib/byebug/commands/eval.rb', line 83

def execute
  out = StringIO.new
  run_with_binding do |b|
    PP.pp(debug_eval(@match.post_match, b), out)
  end
  print out.string
rescue
  out.puts $!.message
end

#regexpObject



79
80
81
# File 'lib/byebug/commands/eval.rb', line 79

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