mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 08:45:42 +03:00
Merge pull request #157 from stomar/avoid_warnings
Avoid warnings in Ruby 1.9.3
This commit is contained in:
@@ -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|
|
||||
|
||||
@@ -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}\">"
|
||||
|
||||
@@ -186,7 +186,7 @@ module Liquid
|
||||
else
|
||||
input
|
||||
end
|
||||
rescue => e
|
||||
rescue
|
||||
input
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user