ruby-changes:21401
From: drbrain <ko1@a...>
Date: Tue, 11 Oct 2011 06:10:12 +0900 (JST)
Subject: [ruby-changes:21401] drbrain:r33450 (trunk): * lib/pp.rb: Move PP documentation to top of class PP. Patch by
drbrain 2011-10-11 06:10:02 +0900 (Tue, 11 Oct 2011) New Revision: 33450 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33450 Log: * lib/pp.rb: Move PP documentation to top of class PP. Patch by Sylvain Daubert. [Ruby 1.9 - Bug #5430] Modified files: trunk/ChangeLog trunk/lib/pp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 33449) +++ ChangeLog (revision 33450) @@ -1,3 +1,8 @@ +Tue Oct 11 06:09:52 2011 Eric Hodel <drbrain@s...> + + * lib/pp.rb: Move PP documentation to top of class PP. Patch by + Sylvain Daubert. [Ruby 1.9 - Bug #5430] + Tue Oct 11 06:06:29 2011 Eric Hodel <drbrain@s...> * ext/coverage/coverage.c (Init_coverage): Change list format and Index: lib/pp.rb =================================================================== --- lib/pp.rb (revision 33449) +++ lib/pp.rb (revision 33450) @@ -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@m...> - -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. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/