Class: Byebug::PutLCommand
- Inherits:
-
Command
show all
- Includes:
- Columnize
- Defined in:
- lib/byebug/commands/eval.rb
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, register_setting_get, register_setting_set, register_setting_var, settings, settings_map, terminal_width
Class Method Details
.description ⇒ Object
126
127
128
129
130
|
# File 'lib/byebug/commands/eval.rb', line 126
def description
%{putl expression
Evaluate expression, an array, and columnize its value}
end
|
.names ⇒ Object
122
123
124
|
# File 'lib/byebug/commands/eval.rb', line 122
def names
%w(putl)
end
|
Instance Method Details
#execute ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/byebug/commands/eval.rb', line 101
def execute
out = StringIO.new
run_with_binding do |b|
if Command.settings[:stack_on_error]
vals = bb_eval(@match.post_match, b)
else
vals = bb_warning_eval(@match.post_match, b)
end
if vals.is_a?(Array)
vals = vals.map{|item| item.to_s}
print "#{columnize(vals, Command.settings[:width])}\n"
else
PP.pp(vals, out)
print out.string
end
end
rescue
out.puts $!.message
end
|
#regexp ⇒ Object
97
98
99
|
# File 'lib/byebug/commands/eval.rb', line 97
def regexp
/^\s* putl\s+/x
end
|