Sha256: 9b0cb049b15911cd11254b56a9515e818aaa688b6da4cf6a12662f2a0e9e0152

Contents?: true

Size: 523 Bytes

Versions: 30

Compression:

Stored size: 523 Bytes

Contents

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

30 entries across 28 versions & 9 rubygems

Version Path
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/formatter/pretty_print_formatter.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/formatter/pretty_print_formatter.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.12/lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.12 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.11 lib/lumberjack/formatter/pretty_print_formatter.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.10/lib/lumberjack/formatter/pretty_print_formatter.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/lumberjack-1.0.10/lib/lumberjack/formatter/pretty_print_formatter.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.10 lib/lumberjack/formatter/pretty_print_formatter.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
geminfo-0.1.0 path/gems/lumberjack-1.0.9/lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.9 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.8 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.7 lib/lumberjack/formatter/pretty_print_formatter.rb
lumberjack-1.0.6 lib/lumberjack/formatter/pretty_print_formatter.rb