Skip to content

Commit 06f624e

Browse files
committed
Update method_compiler.rb
1 parent 11a320b commit 06f624e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/phlex/compiler/method_compiler.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ def visit_phlex_block(node)
9898
elsif content_block?(node)
9999
content = node.body.body.first
100100
case content
101-
when Prism::StringNode
101+
when Prism::StringNode, Prism::SymbolNode
102102
buffer(Phlex::Escape.html_escape(content.unescaped))
103103
when Prism::InterpolatedStringNode
104104
compile_interpolated_string_node(content)
105+
when Prism::NilNode
106+
nil
105107
else
106108
raise
107109
end
@@ -289,7 +291,7 @@ def compile_raw_helper(node)
289291

290292
private def content_block?(node)
291293
return false unless node.body.body.length == 1
292-
node.body.body.first in Prism::StringNode | Prism::InterpolatedStringNode
294+
node.body.body.first in Prism::StringNode | Prism::InterpolatedStringNode | Prism::SymbolNode | Prism::NilNode
293295
end
294296

295297
private def standard_element?(node)

0 commit comments

Comments
 (0)