Skip to content

Commit 3eb18d6

Browse files
committed
Fix warning: shadowing outer local variable
Versions of ruby deal with shadowing in different ways. Best to avoid it when possible. Addresses the following warnings: lib/google/api_client/auth/key_utils.rb:34: warning: shadowing outer local variable - passphrase lib/google/api_client/auth/key_utils.rb:52: warning: shadowing outer local variable - passphrase
1 parent 4d81ad1 commit 3eb18d6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/google/api_client/auth/key_utils.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,44 @@ module KeyUtils
2525
#
2626
# @param [String] keyfile
2727
# Path of the PKCS12 file to load. If not a path to an actual file,
28-
# assumes the string is the content of the file itself.
28+
# assumes the string is the content of the file itself.
2929
# @param [String] passphrase
3030
# Passphrase for unlocking the private key
3131
#
3232
# @return [OpenSSL::PKey] The private key for signing assertions.
3333
def self.load_from_pkcs12(keyfile, passphrase)
34-
load_key(keyfile, passphrase) do |content, passphrase|
35-
OpenSSL::PKCS12.new(content, passphrase).key
34+
load_key(keyfile, passphrase) do |content, pass_phrase|
35+
OpenSSL::PKCS12.new(content, pass_phrase).key
3636
end
3737
end
38-
38+
3939

4040
##
4141
# Loads a key from a PEM file.
4242
#
4343
# @param [String] keyfile
4444
# Path of the PEM file to load. If not a path to an actual file,
45-
# assumes the string is the content of the file itself.
45+
# assumes the string is the content of the file itself.
4646
# @param [String] passphrase
4747
# Passphrase for unlocking the private key
4848
#
4949
# @return [OpenSSL::PKey] The private key for signing assertions.
5050
#
5151
def self.load_from_pem(keyfile, passphrase)
52-
load_key(keyfile, passphrase) do | content, passphrase|
53-
OpenSSL::PKey::RSA.new(content, passphrase)
52+
load_key(keyfile, passphrase) do | content, pass_phrase|
53+
OpenSSL::PKey::RSA.new(content, pass_phrase)
5454
end
5555
end
5656

5757
private
58-
58+
5959
##
6060
# Helper for loading keys from file or memory. Accepts a block
6161
# to handle the specific file format.
6262
#
6363
# @param [String] keyfile
6464
# Path of thefile to load. If not a path to an actual file,
65-
# assumes the string is the content of the file itself.
65+
# assumes the string is the content of the file itself.
6666
# @param [String] passphrase
6767
# Passphrase for unlocking the private key
6868
#
@@ -86,8 +86,8 @@ def self.load_key(keyfile, passphrase, &block)
8686
block.call(content, passphrase)
8787
rescue OpenSSL::OpenSSLError
8888
raise ArgumentError.new("Invalid keyfile or passphrase")
89-
end
90-
end
89+
end
90+
end
9191
end
9292
end
9393
end

0 commit comments

Comments
 (0)