mirror of
https://github.com/Shopify/liquid.git
synced 2025-09-21 00:00:32 -04:00
Fix for-tag update to also work properly in Ruby 1.8.
* Follow up commit to 3d7c1c8
This commit is contained in:
parent
3d7c1c80a0
commit
b8d7b9aeda
@ -126,7 +126,7 @@ module Liquid
|
||||
yielded = 0
|
||||
|
||||
# Maintains Ruby 1.8.7 String#each behaviour on 1.9
|
||||
return [collection] if collection.is_a?(String)
|
||||
return [collection] if non_blank_string?(collection)
|
||||
|
||||
collection.each do |item|
|
||||
|
||||
@ -151,7 +151,11 @@ module Liquid
|
||||
end
|
||||
|
||||
def iterable?(collection)
|
||||
collection.respond_to?(:each) || (collection.is_a?(String) && collection != '')
|
||||
collection.respond_to?(:each) || non_blank_string?(collection)
|
||||
end
|
||||
|
||||
def non_blank_string?(collection)
|
||||
collection.is_a?(String) && collection != ''
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user