Skip to content

Business intelligence made simple

Removed extract_vars method [skip ci]

Andrew Kane9aaf41922a6a
diff --git a/lib/blazer.rb b/lib/blazer.rb
index 0fe03894..629d148d 100644
--- a/lib/blazer.rb
+++ b/lib/blazer.rb
@@ -135,13 +135,6 @@ module Blazer
end
end
- # TODO move to Statement and remove in 3.0.0
- def self.extract_vars(statement)
- # strip commented out lines
- # and regex {1} or {1,2}
- statement.to_s.gsub(/\-\-.+/, "").gsub(/\/\*.+\*\//m, "").scan(/\{\w*?\}/i).map { |v| v[1...-1] }.reject { |v| /\A\d+(\,\d+)?\z/.match(v) || v.empty? }.uniq
- end
-
def self.run_checks(schedule: nil)
checks = Blazer::Check.includes(:query)
checks = checks.where(schedule: schedule) if schedule
diff --git a/lib/blazer/statement.rb b/lib/blazer/statement.rb
index 994d733e..af378331 100644
--- a/lib/blazer/statement.rb
+++ b/lib/blazer/statement.rb
@@ -10,7 +10,9 @@ module Blazer
end
def variables
- @variables ||= Blazer.extract_vars(statement)
+ # strip commented out lines
+ # and regex {1} or {1,2}
+ @variables ||= statement.to_s.gsub(/\-\-.+/, "").gsub(/\/\*.+\*\//m, "").scan(/\{\w*?\}/i).map { |v| v[1...-1] }.reject { |v| /\A\d+(\,\d+)?\z/.match(v) || v.empty? }.uniq
end
def add_values(var_params)