Class: Debugger::PutLCommand

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, 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



130
131
132
133
134
# File 'lib/ruby-debug/commands/eval.rb', line 130

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

.help_commandObject



126
127
128
# File 'lib/ruby-debug/commands/eval.rb', line 126

def help_command
  'putl'
end

Instance Method Details

#executeObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/ruby-debug/commands/eval.rb', line 109

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, self.class.settings[:width])
    else
      PP.pp(vals, out)
      print out.string
    end
  end
rescue 
  out.puts $!.message
end

#regexpObject



105
106
107
# File 'lib/ruby-debug/commands/eval.rb', line 105

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