Merge pull request #157 from stomar/avoid_warnings

Avoid warnings in Ruby 1.9.3
This commit is contained in:
Florian Weingarten
2013-06-05 09:10:41 -07:00
6 changed files with 13 additions and 13 deletions
+1
View File
@@ -172,6 +172,7 @@ module Liquid
# Fetches an object starting at the local scope and then moving up the hierachy # Fetches an object starting at the local scope and then moving up the hierachy
def find_variable(key) def find_variable(key)
scope = @scopes.find { |s| s.has_key?(key) } scope = @scopes.find { |s| s.has_key?(key) }
variable = nil
if scope.nil? if scope.nil?
@environments.each do |e| @environments.each do |e|
+1 -1
View File
@@ -57,7 +57,7 @@ module Liquid
result << "<td class=\"col#{col}\">" << render_all(@nodelist, context) << '</td>' result << "<td class=\"col#{col}\">" << render_all(@nodelist, context) << '</td>'
if col == cols and not (index == length - 1) if col == cols and (index != length - 1)
col = 0 col = 0
row += 1 row += 1
result << "</tr>\n<tr class=\"row#{row}\">" result << "</tr>\n<tr class=\"row#{row}\">"
+1 -1
View File
@@ -186,7 +186,7 @@ module Liquid
else else
input input
end end
rescue => e rescue
input input
end end
+2 -2
View File
@@ -48,8 +48,8 @@ module Liquid
end end
if variable.is_a?(Array) if variable.is_a?(Array)
variable.collect do |variable| variable.collect do |var|
context[@template_name[1..-2]] = variable context[@template_name[1..-2]] = var
partial.render(context) partial.render(context)
end end
else else
+3 -3
View File
@@ -11,9 +11,9 @@ module Liquid
context.stack do context.stack do
# First condition is interpreted backwards ( if not ) # First condition is interpreted backwards ( if not )
block = @blocks.first first_block = @blocks.first
unless block.evaluate(context) unless first_block.evaluate(context)
return render_all(block.attachment, context) return render_all(first_block.attachment, context)
end end
# After the first condition unless works just like if # After the first condition unless works just like if
-1
View File
@@ -3,7 +3,6 @@ module Liquid
def self.slice_collection_using_each(collection, from, to) def self.slice_collection_using_each(collection, from, to)
segments = [] segments = []
index = 0 index = 0
yielded = 0
# Maintains Ruby 1.8.7 String#each behaviour on 1.9 # Maintains Ruby 1.8.7 String#each behaviour on 1.9
return [collection] if non_blank_string?(collection) return [collection] if non_blank_string?(collection)