Преглед изворни кода

Hide variables from commented out lines

Andrew Kane пре 8 година
родитељ
комит
283105a0b7
1 измењених фајлова са 2 додато и 1 уклоњено
  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