mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Use Array#each instead of Array#inject to avoid an object allocation (#1341)
This commit is contained in:
@@ -83,9 +83,11 @@ module Liquid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render(context)
|
def render(context)
|
||||||
obj = @filters.inject(context.evaluate(@name)) do |output, (filter_name, filter_args, filter_kwargs)|
|
obj = context.evaluate(@name)
|
||||||
|
|
||||||
|
@filters.each do |filter_name, filter_args, filter_kwargs|
|
||||||
filter_args = evaluate_filter_expressions(context, filter_args, filter_kwargs)
|
filter_args = evaluate_filter_expressions(context, filter_args, filter_kwargs)
|
||||||
context.invoke(filter_name, output, *filter_args)
|
obj = context.invoke(filter_name, obj, *filter_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
context.apply_global_filter(obj)
|
context.apply_global_filter(obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user