Handle recursive array

This commit is contained in:
Ian Ker-Seymer
2024-12-10 19:17:24 -05:00
parent 5e459b884a
commit 820b238288
2 changed files with 16 additions and 6 deletions
+12 -6
View File
@@ -95,15 +95,21 @@ module Liquid
def render_to_output_buffer(context, output)
obj = render(context)
render_obj_to_output(obj, output)
output
end
if obj.is_a?(Array)
obj.each { |o| output << o.to_s }
elsif obj.nil?
else
def render_obj_to_output(obj, output)
case obj
when NilClass
# Do nothing
when Array
obj.each do |o|
render_obj_to_output(o, output)
end
when
output << obj.to_s
end
output
end
def disabled?(_context)