1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

refine previous change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2003-01-20 19:17:15 +00:00
parent f345126746
commit d0ea0b4a8d
2 changed files with 4 additions and 24 deletions

View file

@ -1,7 +1,8 @@
Tue Jan 21 02:55:10 2003 Tanaka Akira <akr@m17n.org> Tue Jan 21 04:15:50 2003 Tanaka Akira <akr@m17n.org>
* lib/pp.rb: Don't redefine `inspect'. * lib/pp.rb: Use redefined `to_s' as well as `inspect'.
(pretty_print_inspect): new method. Useless `pretty_print' methods removed.
(PP::ObjectMixin#pretty_print_inspect): new method.
Mon Jan 20 21:48:43 2003 Akinori MUSHA <knu@iDaemons.org> Mon Jan 20 21:48:43 2003 Akinori MUSHA <knu@iDaemons.org>

View file

@ -242,7 +242,6 @@ class PP < PrettyPrint
# 3. generic pretty_print # 3. generic pretty_print
def pretty_print(pp) def pretty_print(pp)
# specific pretty_print is not defined, try specific inspect.
if /\(Kernel\)#/ !~ method(:inspect).inspect || if /\(Kernel\)#/ !~ method(:inspect).inspect ||
/\(Kernel\)#/ !~ method(:to_s).inspect /\(Kernel\)#/ !~ method(:to_s).inspect
pp.text inspect pp.text inspect
@ -271,14 +270,6 @@ class PP < PrettyPrint
end end
end end
[Numeric, FalseClass, TrueClass, Module].each {|c|
c.class_eval {
def pretty_print(pp)
pp.text self.to_s
end
}
}
class Array class Array
def pretty_print(pp) def pretty_print(pp)
pp.group(1, '[', ']') { pp.group(1, '[', ']') {
@ -419,22 +410,10 @@ class File
end end
end end
class << ARGF
def pretty_print(pp)
pp.text self.to_s
end
end
class Object class Object
include PP::ObjectMixin include PP::ObjectMixin
end end
[Numeric, Symbol, FalseClass, TrueClass, NilClass, Module].each {|c|
c.class_eval {
alias :pretty_print_cycle :pretty_print
}
}
if __FILE__ == $0 if __FILE__ == $0
require 'runit/testcase' require 'runit/testcase'
require 'runit/cui/testrunner' require 'runit/cui/testrunner'