Class: Printers::Plain
- Includes:
- Columnize
- Defined in:
- lib/ruby-debug/printers/plain.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
- #print(path, args = {}) ⇒ Object
- #print_collection(path, collection, &block) ⇒ Object
- #print_variables(variables, _kind) ⇒ Object
Methods inherited from Base
Instance Method Details
#print(path, args = {}) ⇒ Object
6 7 8 9 10 |
# File 'lib/ruby-debug/printers/plain.rb', line 6 def print(path, args = {}) = translate(locate(path), args) << " (y/n) " if parts(path).include?("confirmations") << "\n" end |
#print_collection(path, collection, &block) ⇒ Object
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 |
#print_variables(variables, _kind) ⇒ Object
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 |