Class: Printers::Plain

Inherits:
Base
  • Object
show all
Includes:
Columnize
Defined in:
lib/ruby-debug/printers/plain.rb

Constant Summary

Constants inherited from Base

Base::SEPARATOR

Instance Method Summary collapse

Methods inherited from Base

#type

Instance Method Details



6
7
8
9
10
# File 'lib/ruby-debug/printers/plain.rb', line 6

def print(path, args = {})
  message = translate(locate(path), args)
  message << " (y/n) " if parts(path).include?("confirmations")
  message << "\n"
end


12
13
14
15
16
17
18
19
20
# File 'lib/ruby-debug/printers/plain.rb', line 12

def print_collection(path, collection, &block)
  modifier = get_modifier(path)
  lines = array_of_args(collection, &block).map { |args| print(path, args) }
  if modifier == 'c'
    columnize(lines.map { |l| l.gsub(/\n$/, '') }, Debugger.settings[:width])
  else
    lines.join("")
  end
end


22
23
24
25
26
# File 'lib/ruby-debug/printers/plain.rb', line 22

def print_variables(variables, _kind)
  print_collection("variable.variable", variables) do |(key, value), _|
    {key: key, value: value.nil? ? "nil" : value.to_s}
  end
end