lib/pghero/methods/system.rb in pghero-3.4.1 vs lib/pghero/methods/system.rb in pghero-3.6.0
- old
+ new
@@ -134,11 +134,11 @@
offset = (offset || 0).to_i
end_time = Time.at(((Time.now - offset).to_f / period).ceil * period)
start_time = end_time - duration
# validate input since we need to interpolate below
- raise Error, "Invalid metric name" unless metric_name =~ /\A[a-z\/_]+\z/i
- raise Error, "Invalid database id" unless gcp_database_id =~ /\A[a-z0-9\-:]+\z/i
+ raise Error, "Invalid metric name" unless /\A[a-z\/_]+\z/i.match?(metric_name)
+ raise Error, "Invalid database id" unless /\A[a-z0-9\-:]+\z/i.match?(gcp_database_id)
# we handle four situations:
# 1. google-cloud-monitoring-v3
# 2. google-cloud-monitoring >= 1
# 3. google-cloud-monitoring < 1