aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pp.rb
diff options
context:
space:
mode:
authorOKURA Masafumi <masafumi.o1988@gmail.com>2023-07-19 17:38:07 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-10-25 16:49:09 +0900
commitbf1362306e2c799b0e5ff222b0cdcdb8644adc27 (patch)
tree7256b181fc4529b0acb8b55ea9294513e3aa1476 /lib/pp.rb
parent5461bc18f88f7f335f6456774498efd386c3012f (diff)
downloadruby-bf1362306e2c799b0e5ff222b0cdcdb8644adc27.tar.gz
[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
Diffstat (limited to 'lib/pp.rb')
-rw-r--r--lib/pp.rb5
1 files changed, 1 insertions, 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 <code>#pretty_print(pp)</code> in the class.
+# Note that <code>require 'pp'</code> is needed before redefining <code>#pretty_print(pp)</code>.
#
# <code>#pretty_print</code> 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)