aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib/pp.rb16
2 files changed, 14 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index dbca87e152..a8326a3419 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Oct 14 11:09:09 2007 Tanaka Akira <akr@fsij.org>
+
+ * 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@ruby-lang.org>
* configure.in (AC_SYS_LARGEFILE): keep results also in command
@@ -166,7 +172,7 @@ Tue Oct 9 15:40:24 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Mon Oct 8 20:06:29 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
* 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 @@ Fri Oct 5 03:25:51 2007 Akinori MUSHA <knu@iDaemons.org>
* 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.
diff --git a/lib/pp.rb b/lib/pp.rb
index 53ecaedd59..b815a0d499 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -247,15 +247,7 @@ class PP < PrettyPrint
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 @@ end
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