ruby-changes:39493
From: nobu <ko1@a...>
Date: Fri, 14 Aug 2015 18:40:53 +0900 (JST)
Subject: [ruby-changes:39493] nobu:r51574 (trunk): win32/registry.rb: make @@type2name an array
nobu 2015-08-14 18:40:31 +0900 (Fri, 14 Aug 2015) New Revision: 51574 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51574 Log: win32/registry.rb: make @@type2name an array * ext/win32/lib/win32/registry.rb (@@type2name): make an array instead of a hash, keys are sequential numbers. Modified files: trunk/ext/win32/lib/win32/registry.rb Index: ext/win32/lib/win32/registry.rb =================================================================== --- ext/win32/lib/win32/registry.rb (revision 51573) +++ ext/win32/lib/win32/registry.rb (revision 51574) @@ -377,15 +377,16 @@ For detail, see the MSDN[http://msdn.mic https://github.com/ruby/ruby/blob/trunk/ext/win32/lib/win32/registry.rb#L377 } end - @@type2name = { } - %w[ + @@type2name = %w[ REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD REG_DWORD_BIG_ENDIAN REG_LINK REG_MULTI_SZ REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR REG_RESOURCE_REQUIREMENTS_LIST REG_QWORD - ].each do |type| - @@type2name[Constants.const_get(type)] = type - end + ].inject([]) do |ary, type| + type.freeze + ary[Constants.const_get(type)] = type + ary + end.freeze # # Convert registry type value to readable string. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/