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.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-08-14 09:40:31 +00:00
Родитель 161848b81e
Коммит cac0f9bedc
1 изменённых файлов: 6 добавлений и 5 удалений

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

@ -377,15 +377,16 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
}
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.