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

command_exists?, commands, find, format_subcmd, format_subcmds, help, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width

Constructor Details

This class inherits a constructor from Byebug::Command

Class Method Details

.descriptionObject



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

def description
  %{pp expression\tevaluate expression and pretty-print its value}
end

.namesObject



75
76
77
# File 'lib/byebug/commands/eval.rb', line 75

def names
  %w(pp)
end

Instance Method Details

#executeObject



64
65
66
67
68
69
70
71
72
# File 'lib/byebug/commands/eval.rb', line 64

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



60
61
62
# File 'lib/byebug/commands/eval.rb', line 60

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