Sha256: 93467a95777c98baa1a3af13ea3c9860abe22685d3bf682dafe6b790736b68bc

Contents?: true

Size: 555 Bytes

Versions: 14

Compression:

Stored size: 555 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).
      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

14 entries across 14 versions & 3 rubygems

Version Path
lumberjack-1.2.7 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.6 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.5 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.4 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.3 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.2 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.1 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.2.0 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.1.1 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.1.0 lib/lumberjack/formatter/pretty_print_formatter.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/lumberjack-1.0.13/lib/lumberjack/formatter/pretty_print_formatter.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.13/lib/lumberjack/formatter/pretty_print_formatter.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.13/lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.13 lib/lumberjack/formatter/pretty_print_formatter.rb