lib/blazer/statement.rb in blazer-2.6.5 vs lib/blazer/statement.rb in blazer-3.0.0
- old
+ new
@@ -8,10 +8,12 @@
@data_source = data_source.is_a?(String) ? Blazer.data_sources[data_source] : data_source
@values = {}
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)
variables.each do |var|
value = var_params[var].presence