summaryrefslogtreecommitdiff
path: root/lib/pry/inspector.rb
blob: 6e8a692cc32ef76a95aaf1f622856fdc9b0d7d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

class Pry
  class Inspector
    MAP = {
      "default" => {
        value: Pry.config.print,
        description: <<-DESCRIPTION.each_line.map(&:lstrip!)
          The default Pry inspector. It has paging and color support, and uses
          pretty_inspect when printing an object.
        DESCRIPTION
      },

      "simple" => {
        value: proc do |output, value|
          begin
            output.puts value.inspect
          rescue RescuableException
            output.puts "unknown"
          end
        end,
        description: <<-DESCRIPTION.each_line.map(&:lstrip)
          A simple inspector that uses #puts and #inspect when printing an
          object. It has no pager, color, or pretty_inspect support.
        DESCRIPTION
      },

      "clipped" => {
        value: proc do |output, value|
          output.puts Pry.view_clip(value, id: true)
        end,
        description: <<-DESCRIPTION.each_line.map(&:lstrip)
          The clipped inspector has the same features as the 'simple' inspector
          but prints large objects as a smaller string.
        DESCRIPTION
      }
    }.freeze
  end
end