fix: Set instance variables at initialization to avoid spamming rake warnings

This commit is contained in:
Ling Huang 2019-08-15 21:46:38 -04:00 committed by Daniel Azuma
parent efb9b7897a
commit 2cd6af174d
2 changed files with 5 additions and 2 deletions

View File

@ -257,6 +257,9 @@ module Google
CredentialsLoader.warn_if_cloud_sdk_credentials @client.client_id CredentialsLoader.warn_if_cloud_sdk_credentials @client.client_id
@project_id ||= CredentialsLoader.load_gcloud_project_id @project_id ||= CredentialsLoader.load_gcloud_project_id
@client.fetch_access_token! @client.fetch_access_token!
@env_vars = nil
@paths = nil
@scope = nil
end end
# rubocop:enable Metrics/AbcSize # rubocop:enable Metrics/AbcSize

View File

@ -66,7 +66,7 @@ module Signet
end end
def on_refresh &block def on_refresh &block
@refresh_listeners ||= [] @refresh_listeners = [] unless defined? @refresh_listeners
@refresh_listeners << block @refresh_listeners << block
end end
@ -84,7 +84,7 @@ module Signet
end end
def notify_refresh_listeners def notify_refresh_listeners
listeners = @refresh_listeners || [] listeners = defined?(@refresh_listeners) ? @refresh_listeners : []
listeners.each do |block| listeners.each do |block|
block.call self block.call self
end end