lib/processors/lib/render_helper.rb in brakeman-0.0.3 vs lib/processors/lib/render_helper.rb in brakeman-0.1.0

- old
+ new

@@ -17,10 +17,18 @@ when :nothing end exp end + #Processes layout + def process_layout name = nil + layout = name || layout_name + return unless layout + + process_template layout, nil + end + #Determines file name for partial and then processes it def process_partial name, args if name == "" or !(string? name or symbol? name) return end @@ -58,9 +66,20 @@ return else @tracker.template_cache << digest options = get_options args + + #Process layout + if string? options[:layout] + process_template "layouts/#{options[:layout][1]}", nil + elsif sexp? options[:layout] and options[:layout][0] == :false + #nothing + elsif not template[:name].to_s.match(/[^\/_][^\/]+$/) + #Don't do this for partials + + process_layout + end if hash? options[:locals] hash_iterate options[:locals] do |key, value| template_env[Sexp.new(:call, nil, key[1], Sexp.new(:arglist))] = value end