summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-07 13:02:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-07 13:02:29 +0000
commit03e45b46eaa6f91ec337847afbadc1f3c0170e71 (patch)
treea2c90104d823dfa102bad79076c8745eaffecda3 /lib
parent1cf8e928018a2424bdd8fb602abea143d54c7144 (diff)
* lib/pp.rb (Kernel.pp): module function.
(MatchData#pretty_print): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pp.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index b14611ff05..2d09af4344 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -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