diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-07 13:02:29 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-03-07 13:02:29 +0000 |
commit | ba6dbd79c96b19e33f1e8feb9d5d6e9b4e50c56c (patch) | |
tree | a2c90104d823dfa102bad79076c8745eaffecda3 | |
parent | c5f247792bddc174105d72923769a48e3ac73c66 (diff) | |
download | ruby-ba6dbd79c96b19e33f1e8feb9d5d6e9b4e50c56c.tar.gz ruby-ba6dbd79c96b19e33f1e8feb9d5d6e9b4e50c56c.tar.xz ruby-ba6dbd79c96b19e33f1e8feb9d5d6e9b4e50c56c.zip |
* lib/pp.rb (Kernel.pp): module function.
(MatchData#pretty_print): new method.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/pp.rb | 13 |
2 files changed, 18 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Fri Mar 7 21:57:25 2003 Tanaka Akira <akr@m17n.org> + + * lib/pp.rb (Kernel.pp): module function. + (MatchData#pretty_print): new method. + Fri Mar 7 20:27:19 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> * ext/tcltklib/extconf.rb (find_tcl, find_tk): return true if @@ -127,6 +127,7 @@ module Kernel } nil end + module_function :pp end class PP < PrettyPrint @@ -410,6 +411,18 @@ class File end end +class MatchData + def pretty_print(pp) + pp.object_group(self) { + pp.breakable + 1.upto(self.size) {|i| + pp.breakable unless pp.first? + pp.pp self[i-1] + } + } + end +end + class Object include PP::ObjectMixin end |