mirror of
https://github.com/kemko/liquid.git
synced 2026-01-06 02:05:41 +03:00
allow drops to optimize loading a slice of elements
This commit is contained in:
@@ -75,8 +75,11 @@ module Liquid
|
||||
limit = context[@attributes['limit']]
|
||||
to = limit ? limit.to_i + from : nil
|
||||
|
||||
|
||||
segment = Utils.slice_collection_using_each(collection, from, to)
|
||||
segment = if (from != 0 || to != nil) && collection.respond_to?(:load_slice)
|
||||
collection.load_slice(from, to)
|
||||
else
|
||||
Utils.slice_collection_using_each(collection, from, to)
|
||||
end
|
||||
|
||||
return render_else(context) if segment.empty?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user