class method
Win32::Registry.expand_environ
expand_environ(str)
ext/win32/lib/win32/registry.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/ext/win32/lib/win32/registry.rb, line 381
def self.expand_environ(str)
str.gsub(Regexp.compile("%([^%]+)%".encode(str.encoding))) {
v = $1.encode(LOCALE)
(ENV[v] || ENV[v.upcase])&.encode(str.encoding) || $&
}
end
Replace %-enclosed substrings in str into the environment value of what is contained between the %s. This method is used for REG_EXPAND_SZ.
For detail, see ExpandEnvironmentStrings Win32 API.