* hash.c: Alias ENV.to_h to ENV.to_hash [ref #6276]

[rubyspec:6587eead7cd1]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2012-04-16 03:16:40 +00:00
Родитель db66739c7c
Коммит fc7676fcd6
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,16 @@
Mon Apr 16 12:13:42 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
* 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@ruby-lang.org>
* lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#download): should

4
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.

4
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);