class Byebug::PutLCommand


Evaluation, pretty printing and columnizing from byebug’s prompt.

def description

def description
  %(putl <expression>
    Evaluates <expression>, an array, and columnize its value.)
end

def execute

def execute
  out = StringIO.new
  run_with_binding do |b|
    if Setting[: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 }
      puts "#{columnize(vals, Setting[:width])}"
    else
      PP.pp(vals, out)
      puts out.string
    end
  end
rescue
  out.puts $ERROR_INFO.message
end

def names

def names
  %w(putl)
end

def regexp

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