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

View File

@@ -172,6 +172,7 @@ module Liquid
# Fetches an object starting at the local scope and then moving up the hierachy
def find_variable(key)
scope = @scopes.find { |s| s.has_key?(key) }
variable = nil
if scope.nil?
@environments.each do |e|

View File

@@ -57,7 +57,7 @@ module Liquid
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
row += 1
result << "</tr>\n<tr class=\"row#{row}\">"

View File

@@ -186,7 +186,7 @@ module Liquid
else
input
end
rescue => e
rescue
input
end

View File

@@ -48,8 +48,8 @@ module Liquid
end
if variable.is_a?(Array)
variable.collect do |variable|
context[@template_name[1..-2]] = variable
variable.collect do |var|
context[@template_name[1..-2]] = var
partial.render(context)
end
else

View File

@@ -9,25 +9,25 @@ module Liquid
class Unless < If
def render(context)
context.stack do
# First condition is interpreted backwards ( if not )
block = @blocks.first
unless block.evaluate(context)
return render_all(block.attachment, context)
first_block = @blocks.first
unless first_block.evaluate(context)
return render_all(first_block.attachment, context)
end
# After the first condition unless works just like if
@blocks[1..-1].each do |block|
if block.evaluate(context)
return render_all(block.attachment, context)
end
end
''
end
end
end
Template.register_tag('unless', Unless)
end
end

View File

@@ -3,7 +3,6 @@ module Liquid
def self.slice_collection_using_each(collection, from, to)
segments = []
index = 0
yielded = 0
# Maintains Ruby 1.8.7 String#each behaviour on 1.9
return [collection] if non_blank_string?(collection)