Browse Source

Hide variables from commented out lines

Andrew Kane 8 năm trước cách đây
mục cha
commit
283105a0b7
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      app/controllers/blazer/base_controller.rb

+ 2 - 1
app/controllers/blazer/base_controller.rb

@@ -41,7 +41,8 @@ module Blazer
     end
 
     def extract_vars(statement)
-      statement.scan(/\{.*?\}/).map { |v| v[1...-1] }.uniq
+      # strip commented out lines
+      statement.gsub(/\-\-.+/, "").gsub(/\/\*.+\*\//m, "").scan(/\{.*?\}/).map { |v| v[1...-1] }.uniq
     end
     helper_method :extract_vars