Sha256: 82e69d01d567d3921e7f50200d44e576bb9fecdf9ac07cf1b10234a37a3a77f4

Contents?: true

Size: 616 Bytes

Versions: 2

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literals: true

require "pp"
require "stringio"

module Lumberjack
  class Formatter
    # Format an object with it's pretty print method.
    class PrettyPrintFormatter
      attr_accessor :width

      # Create a new formatter. The maximum width of the message can be specified with the width
      # parameter (defaults to 79 characters).
      #
      # @param [Integer] width The maximum width of the message.
      def initialize(width = 79)
        @width = width
      end

      def call(obj)
        s = StringIO.new
        PP.pp(obj, s)
        s.string.chomp
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/lumberjack-1.2.9/lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.9 lib/lumberjack/formatter/pretty_print_formatter.rb