fast-path String in render_obj_to_output, avoid Utils.to_s dispatch for common case

This commit is contained in:
Tobi Lutke
2026-03-11 07:24:30 -04:00
parent fa412245f7
commit c1113ad2f8
+4 -3
View File
@@ -111,10 +111,11 @@ module Liquid
end end
def render_obj_to_output(obj, output) def render_obj_to_output(obj, output)
case obj if obj.instance_of?(String)
when NilClass output << obj
elsif obj.nil?
# Do nothing # Do nothing
when Array elsif obj.instance_of?(Array)
obj.each do |o| obj.each do |o|
render_obj_to_output(o, output) render_obj_to_output(o, output)
end end