[前][次][番号順一覧][スレッド一覧]

ruby-changes:23292

From: marcandre <ko1@a...>
Date: Mon, 16 Apr 2012 12:16:49 +0900 (JST)
Subject: [ruby-changes:23292] marcandRe: r35343 (trunk): * hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]

marcandre	2012-04-16 12:16:40 +0900 (Mon, 16 Apr 2012)

  New Revision: 35343

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35343

  Log:
    * hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]
      [rubyspec:6587eead7cd1]

  Modified files:
    trunk/ChangeLog
    trunk/NEWS
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35342)
+++ ChangeLog	(revision 35343)
@@ -1,3 +1,16 @@
+Mon Apr 16 12:13:42 2012  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]
+	  [rubyspec:6587eead7cd1]
+	* lib/ostruct.rb: Add OpenStruct#to_h [Feature #6276]
+	  [ref #1400] [rubyspec:9e0250b2fc6f]
+	* struct.c: Add Struct#to_h [Feature #6276]
+	  [ref #4862] [rubyspec:2082ef46d46e]
+	* object.c: Add NilClass#to_h [Feature #6276]
+	  [ref #5008] [rubyspec:dc5ecddbd608]
+	* hash.c: Add Hash#to_h [Feature #6276]
+	  [rubyspec:84b7fe3f24d2]
+
 Mon Apr 16 09:42:50 2012  NAKAMURA Usaku  <usa@r...>
 
 	* lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#download): should
Index: hash.c
===================================================================
--- hash.c	(revision 35342)
+++ hash.c	(revision 35343)
@@ -3078,7 +3078,8 @@
 
 /*
  * call-seq:
- *   ENV.to_hash -> Hash
+ *   ENV.to_hash -> hash
+ *   ENV.to_h    -> hash
  *
  * Creates a hash with a copy of the environment variables.
  *
@@ -3468,6 +3469,7 @@
     rb_define_singleton_method(envtbl,"key?", env_has_key, 1);
     rb_define_singleton_method(envtbl,"value?", env_has_value, 1);
     rb_define_singleton_method(envtbl,"to_hash", env_to_hash, 0);
+    rb_define_singleton_method(envtbl,"to_h", env_to_hash, 0);
     rb_define_singleton_method(envtbl,"assoc", env_assoc, 1);
     rb_define_singleton_method(envtbl,"rassoc", env_rassoc, 1);
 
Index: NEWS
===================================================================
--- NEWS	(revision 35342)
+++ NEWS	(revision 35343)
@@ -21,6 +21,10 @@
     * added method:
       * added Enumerable#lazy method for lazy enumeration.
 
+  * ENV
+    * aliased method:
+      * ENV.to_h is a new alias for ENV.to_hash
+
   * Hash
     * added method:
       * added Hash#to_h as explicit conversion method, like Array#to_a.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]