Class: Debugger::PSCommand

Inherits:
Command
  • Object
show all
Includes:
EvalFunctions
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 included from EvalFunctions

#run_with_binding

Methods inherited from Command

commands, #find, inherited, #initialize, load_commands, #match, method_missing, options, register_setting_get, register_setting_set, register_setting_var, settings, settings_map

Constructor Details

This class inherits a constructor from Debugger::Command

Class Method Details

.help(cmd) ⇒ Object



168
169
170
171
172
# File 'lib/ruby-debug/commands/eval.rb', line 168

def help(cmd)
  %{
    ps expression\tevaluate expression, an array, sort, and columnize its value
  }
end

.help_commandObject



164
165
166
# File 'lib/ruby-debug/commands/eval.rb', line 164

def help_command
  'ps'
end

Instance Method Details

#executeObject



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/ruby-debug/commands/eval.rb', line 147

def execute
  out = StringIO.new
  run_with_binding do |b|
    vals = debug_eval(@match.post_match, b)
    if vals.is_a?(Array)
      vals = vals.map{|item| item.to_s}
      print "%s\n", columnize(vals.sort!, self.class.settings[:width])
    else
      PP.pp(vals, out)
      print out.string
    end
  end
rescue 
  out.puts $!.message
end

#regexpObject



143
144
145
# File 'lib/ruby-debug/commands/eval.rb', line 143

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