summaryrefslogtreecommitdiff
path: root/lib/pp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pp.rb')
-rw-r--r--lib/pp.rb43
1 files changed, 21 insertions, 22 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index 56d726dc7d..d8f12f7b4d 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,3 +1,24 @@
+require 'prettyprint'
+
+module Kernel
+ # returns a pretty printed object as a string.
+ def pretty_inspect
+ PP.pp(self, '')
+ end
+
+ private
+ # prints arguments in pretty form.
+ #
+ # pp returns argument(s).
+ def pp(*objs) # :doc:
+ objs.each {|obj|
+ PP.pp(obj)
+ }
+ objs.size <= 1 ? objs.first : objs
+ end
+ module_function :pp
+end
+
# == Pretty-printer for Ruby objects.
#
# = Which seems better?
@@ -42,28 +63,6 @@
#
# = Author
# Tanaka Akira <akr@m17n.org>
-
-require 'prettyprint'
-
-module Kernel
- # returns a pretty printed object as a string.
- def pretty_inspect
- PP.pp(self, '')
- end
-
- private
- # prints arguments in pretty form.
- #
- # pp returns argument(s).
- def pp(*objs) # :doc:
- objs.each {|obj|
- PP.pp(obj)
- }
- objs.size <= 1 ? objs.first : objs
- end
- module_function :pp
-end
-
class PP < PrettyPrint
# Outputs +obj+ to +out+ in pretty printed format of
# +width+ columns in width.