summaryrefslogtreecommitdiff
path: root/ext/win32
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 09:40:31 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 09:40:31 (GMT)
commitcac0f9bedc120aebb353b431b3393168e4a06976 (patch)
tree56420dfd957a213994c1003f25135c5d303a8a38 /ext/win32
parent161848b81e05a0c8b816eba875b22af00e4d8b39 (diff)
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
Diffstat (limited to 'ext/win32')
-rw-r--r--ext/win32/lib/win32/registry.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb
index f0166d6..1e12f4b 100644
--- a/ext/win32/lib/win32/registry.rb
+++ b/ext/win32/lib/win32/registry.rb
@@ -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.