mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-16 17:30:43 -07:00
Instrument usage of bug with iteration of String with offset or 0 limit (#1667)
This commit is contained in:
+5
-1
@@ -16,7 +16,11 @@ module Liquid
|
||||
|
||||
# Maintains Ruby 1.8.7 String#each behaviour on 1.9
|
||||
if collection.is_a?(String)
|
||||
return collection.empty? ? [] : [collection]
|
||||
return [] if collection.empty?
|
||||
if from > 0 || to == 0
|
||||
Usage.increment("string_slice_bug")
|
||||
end
|
||||
return [collection]
|
||||
end
|
||||
return [] unless collection.respond_to?(:each)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user