From bf1362306e2c799b0e5ff222b0cdcdb8644adc27 Mon Sep 17 00:00:00 2001 From: OKURA Masafumi Date: Wed, 19 Jul 2023 17:38:07 +0900 Subject: [PATCH] [Doc] Improve documentation of PP * Remove mention to `require 'pp'` for `pretty_inspect` * Mention the need to add `require 'pp'` to customize `#pretty_print(pp)` method --- lib/pp.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/pp.rb b/lib/pp.rb index b81f84cec5..a2d4ebe41b 100644 --- a/lib/pp.rb +++ b/lib/pp.rb @@ -46,6 +46,7 @@ require 'prettyprint' # # To define a customized pretty printing function for your classes, # redefine method #pretty_print(pp) in the class. +# Note that require 'pp' is needed before redefining #pretty_print(pp). # # #pretty_print takes the +pp+ argument, which is an instance of the PP class. # The method uses #text, #breakable, #nest, #group and #pp to print the @@ -632,10 +633,6 @@ end module Kernel # Returns a pretty printed object as a string. # - # In order to use this method you must first require the PP module: - # - # require 'pp' - # # See the PP module for more information. def pretty_inspect PP.pp(self, ''.dup)