mirror of
https://github.com/kemko/liquid.git
synced 2026-01-06 18:25:41 +03:00
Revert "Revert "Added backwards compatibility for 1.8.7 String.each returning itself (and 1.9.3 not supporting .each).""
This reverts commit bce0033c65.
This commit is contained in:
@@ -75,7 +75,8 @@ module Liquid
|
||||
collection = context[@collection_name]
|
||||
collection = collection.to_a if collection.is_a?(Range)
|
||||
|
||||
return render_else(context) unless collection.respond_to?(:each)
|
||||
# 1.8.7 compatibility
|
||||
return render_else(context) unless collection.respond_to?(:each) or collection.is_a?(String)
|
||||
|
||||
from = if @attributes['offset'] == 'continue'
|
||||
context.registers[:for][@name].to_i
|
||||
@@ -123,6 +124,10 @@ module Liquid
|
||||
segments = []
|
||||
index = 0
|
||||
yielded = 0
|
||||
|
||||
# 1.8.7 compatibility
|
||||
return [collection] if collection.is_a?(String)
|
||||
|
||||
collection.each do |item|
|
||||
|
||||
if to && to <= index
|
||||
|
||||
Reference in New Issue
Block a user