Provide Block#new_body so that liquid-c can override it

This way liquid-c can return a body of a different class that wraps
a C implementation.
This commit is contained in:
Dylan Thacker-Smith
2020-09-08 13:59:48 -04:00
parent 6ca5b62112
commit bd33df09de
4 changed files with 14 additions and 8 deletions
+8 -2
View File
@@ -10,7 +10,7 @@ module Liquid
end
def parse(tokens)
@body = BlockBody.new
@body = new_body
while parse_body(@body, tokens)
end
end
@@ -55,8 +55,14 @@ module Liquid
@block_delimiter ||= "end#{block_name}"
end
protected
private
# @api public
def new_body
BlockBody.new
end
# @api public
def parse_body(body, tokens)
if parse_context.depth >= MAX_DEPTH
raise StackLevelError, "Nesting too deep"