Sha256: 3fcadcc2f9a802ba09a58c7276adc9d55c7510d511460695366c709371e49d0b
Contents?: true
Size: 634 Bytes
Versions: 7
Compression:
Stored size: 634 Bytes
Contents
# TODO How useful is this really? Or, can it go in with something else? require 'pp' require 'stringio' module Kernel # Returns a pretty-printed string of the object. Requires libraries +pp+ and # +stringio+ from the Ruby standard library. # # The following code pretty-prints an object (much like +p+ plain-prints an # object): # # pp object # # The following code captures the pretty-printing in +str+ instead of # sending it to +STDOUT+. # # str = object.pp_s # # CREDIT Noah Gibbs # CREDIT Gavin Sinclair def pp_s pps = StringIO.new PP.pp(self, pps) pps.string end end
Version data entries
7 entries across 7 versions & 1 rubygems