diff --git a/ChangeLog b/ChangeLog index e0a72d325b..68faef86eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Mon Apr 16 12:13:42 2012 Marc-Andre Lafortune + + * 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 * lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#download): should diff --git a/NEWS b/NEWS index 2c9681d94a..55c4c41289 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,10 @@ with all sufficient information, see the ChangeLog file. * 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. diff --git a/hash.c b/hash.c index e255dab3ed..3427ec0eb8 100644 --- a/hash.c +++ b/hash.c @@ -3078,7 +3078,8 @@ env_index(VALUE dmy, VALUE value) /* * 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 @@ Init_Hash(void) 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);