lib/google/cloud/spanner.rb in google-cloud-spanner-2.18.1 vs lib/google/cloud/spanner.rb in google-cloud-spanner-2.19.0
- old
+ new
@@ -94,11 +94,11 @@
endpoint: nil, project: nil, keyfile: nil,
emulator_host: nil, lib_name: nil, lib_version: nil
project_id ||= project || default_project_id
scope ||= configure.scope
timeout ||= configure.timeout
- emulator_host ||= configure.emulator_host
+ emulator_host = present_or_nil(emulator_host) || present_or_nil(configure.emulator_host)
endpoint ||= emulator_host || configure.endpoint
credentials ||= keyfile
lib_name ||= configure.lib_name
lib_version ||= configure.lib_version
@@ -178,9 +178,16 @@
# @private Default credentials.
def self.default_credentials scope: nil
Google::Cloud.configure.spanner.credentials ||
Google::Cloud.configure.credentials ||
Spanner::Credentials.default(scope: scope)
+ end
+
+ ##
+ # @private checks if string is not nil or empty string
+ # returns the string if present else nil
+ def self.present_or_nil str
+ str.to_s.strip.empty? ? nil : str
end
end
end
# @private