ruby-changes:2205
From: ko1@a...
Date: 14 Oct 2007 11:14:33 +0900
Subject: [ruby-changes:2205] akr - Ruby:r13696 (trunk): * lib/pp.rb (PP::PPMethods#pp_hash): don't sort keys because hash is
akr 2007-10-14 11:14:16 +0900 (Sun, 14 Oct 2007)
New Revision: 13696
Modified files:
trunk/ChangeLog
trunk/lib/pp.rb
Log:
* lib/pp.rb (PP::PPMethods#pp_hash): don't sort keys because hash is
ordered.
(ENV.pretty_print): call pp_hash with sorted hash.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/pp.rb?r1=13696&r2=13695
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13696&r2=13695
Index: ChangeLog
===================================================================
--- ChangeLog (revision 13695)
+++ ChangeLog (revision 13696)
@@ -1,3 +1,9 @@
+Sun Oct 14 11:09:09 2007 Tanaka Akira <akr@f...>
+
+ * lib/pp.rb (PP::PPMethods#pp_hash): don't sort keys because hash is
+ ordered.
+ (ENV.pretty_print): call pp_hash with sorted hash.
+
Sun Oct 14 04:08:34 2007 Nobuyoshi Nakada <nobu@r...>
* configure.in (AC_SYS_LARGEFILE): keep results also in command
@@ -166,7 +172,7 @@
Mon Oct 8 20:06:29 2007 GOTOU Yuuzou <gotoyuzo@n...>
* lib/net/imap.rb, lib/net/smtp.rb, lib/net/pop.rb: hostname should
- be verified against server's indentity as persented in the server's
+ be verified against server's identity as presented in the server's
certificate. [ruby-dev:31960]
* ext/openssl/lib/net/telnets.rb, ext/openssl/lib/net/ftptls.rb: ditto.
@@ -261,7 +267,7 @@
* lib/ipaddr.rb (succ): Implement IPAddr#succ. You can now create
a range between two IPAddr's, which (Range) object is
- enumeratable.
+ enumerable.
* lib/ipaddr.rb (to_range): A new method to create a Range object
for the (network) address.
Index: lib/pp.rb
===================================================================
--- lib/pp.rb (revision 13695)
+++ lib/pp.rb (revision 13696)
@@ -247,15 +247,7 @@
def pp_hash(obj)
group(1, '{', '}') {
- keys = obj.keys
- if 0 < keys.length
- key_class = keys[0].class
- if key_class < Comparable && keys.all? {|k| k.class == key_class }
- keys.sort!
- end
- end
- seplist(keys, nil, :each) {|k|
- v = obj[k]
+ seplist(obj, nil, :each_pair) {|k, v|
group {
pp k
text '=>'
@@ -359,7 +351,11 @@
class << ENV
def pretty_print(q)
- q.pp_hash self
+ h = {}
+ ENV.keys.sort.each {|k|
+ h[k] = ENV[k]
+ }
+ q.pp_hash h
end
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml