Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Win32::Registry#[]
[](name, *rtype)
ext/win32/lib/win32/registry.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/ext/win32/lib/win32/registry.rb, line 694
def [](name, *rtype)
type, data = read(name, *rtype)
case type
when REG_SZ, REG_DWORD, REG_QWORD, REG_MULTI_SZ
data
when REG_EXPAND_SZ
Registry.expand_environ(data)
else
raise TypeError, "Type #{Registry.type2name(type)} is not supported."
end
end
Read a registry value named name and return its value data. The class of the value is the same as the read method returns.
If the value type is REG_EXPAND_SZ, returns value data whose environment variables are replaced. If the value type is neither REG_SZ, REG_MULTI_SZ, REG_DWORD, REG_DWORD_BIG_ENDIAN, nor REG_QWORD, TypeError is raised.
The meaning of rtype is the same as for the read method.