Skip to content

Commit

Permalink
win32/registry: Shorten with safe navigation operator
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed May 3, 2024
1 parent 491c38b commit 7662e6f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ext/win32/lib/win32/registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,7 @@ def QueryInfoKey(hkey)
def self.expand_environ(str)
str.gsub(Regexp.compile("%([^%]+)%".encode(str.encoding))) {
v = $1.encode(LOCALE)
(e = ENV[v] || ENV[v.upcase]; e.encode(str.encoding) if e) ||
$&
(ENV[v] || ENV[v.upcase])&.encode(str.encoding) || $&
}
end

Expand Down

0 comments on commit 7662e6f

Please sign in to comment.