Fix for-tag update to also work properly in Ruby 1.8.

* Follow up commit to 3d7c1c8
This commit is contained in:
Dennis Theisen 2012-02-29 16:13:46 -05:00
parent 3d7c1c80a0
commit b8d7b9aeda

View File

@ -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