@@ -13,7 +13,6 @@ class Compiler
1313 def initialize ( component )
1414 @component = component
1515 @lock = Mutex . new
16- @rendered_templates = Set . new
1716 end
1817
1918 def compiled?
@@ -56,10 +55,6 @@ def compile(raise_errors: false, force: false)
5655 end
5756 end
5857
59- def renders_template_for? ( variant , format )
60- @rendered_templates . include? ( [ variant , format ] )
61- end
62-
6358 private
6459
6560 attr_reader :templates
@@ -71,9 +66,9 @@ def define_render_template_for
7166
7267 method_body =
7368 if @templates . one?
74- @templates . first . safe_method_name
69+ @templates . first . safe_method_name_call
7570 elsif ( template = @templates . find ( &:inline? ) )
76- template . safe_method_name
71+ template . safe_method_name_call
7772 else
7873 branches = [ ]
7974
@@ -88,13 +83,13 @@ def define_render_template_for
8883 ] . join ( " && " )
8984 end
9085
91- branches << [ conditional , template . safe_method_name ]
86+ branches << [ conditional , template . safe_method_name_call ]
9287 end
9388
9489 out = branches . each_with_object ( +"" ) do |( conditional , branch_body ) , memo |
9590 memo << "#{ ( !memo . present? ) ? "if" : "elsif" } #{ conditional } \n #{ branch_body } \n "
9691 end
97- out << "else\n #{ templates . find { _1 . variant . nil? && _1 . default_format? } . safe_method_name } \n end"
92+ out << "else\n #{ templates . find { _1 . variant . nil? && _1 . default_format? } . safe_method_name_call } \n end"
9893 end
9994
10095 @component . silence_redefinition_of_method ( :render_template_for )
@@ -196,10 +191,6 @@ def gather_templates
196191 variant : variant
197192 )
198193
199- # TODO: We should consider inlining the HTML output safety logic into the compiled render_template_for
200- # instead of this indirect approach
201- @rendered_templates << [ out . variant , out . this_format ]
202-
203194 out
204195 end
205196
0 commit comments