diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pp.rb | 53 |
1 files changed, 27 insertions, 26 deletions
@@ -2,32 +2,6 @@ require 'prettyprint' -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) - end - - # prints arguments in pretty form. - # - # pp returns argument(s). - alias __pp_backup__ pp if method_defined?(:pp) - def pp(*objs) - objs.each {|obj| - PP.pp(obj) - } - objs.size <= 1 ? objs.first : objs - end - undef __pp_backup__ if method_defined?(:__pp_backup__) - module_function :pp -end - ## # A pretty-printer for Ruby objects. # @@ -562,3 +536,30 @@ end 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) + end + + # prints arguments in pretty form. + # + # pp returns argument(s). + alias __pp_backup__ pp if method_defined?(:pp) + def pp(*objs) + objs.each {|obj| + PP.pp(obj) + } + objs.size <= 1 ? objs.first : objs + end + undef __pp_backup__ if method_defined?(:__pp_backup__) + module_function :pp +end + |