Avoid parallel assignments

This commit is contained in:
Florian Weingarten
2014-10-17 23:15:04 +00:00
parent a056f6521c
commit 7196a2d58e
4 changed files with 15 additions and 7 deletions

View File

@@ -11,7 +11,8 @@ class LiquidServlet < WEBrick::HTTPServlet::AbstractServlet
private
def handle(type, req, res)
@request, @response = req, res
@request = req
@response = res
@request.path_info =~ /(\w+)\z/
@action = $1 || 'index'

View File

@@ -28,7 +28,9 @@ module Liquid
attr_accessor :left, :operator, :right
def initialize(left = nil, operator = nil, right = nil)
@left, @operator, @right = left, operator, right
@left = left
@operator = operator
@right = right
@child_relation = nil
@child_condition = nil
end
@@ -47,11 +49,13 @@ module Liquid
end
def or(condition)
@child_relation, @child_condition = :or, condition
@child_relation = :or
@child_condition = condition
end
def and(condition)
@child_relation, @child_condition = :and, condition
@child_relation = :and
@child_condition = condition
end
def attach(attachment)
@@ -94,7 +98,8 @@ module Liquid
# return this as the result.
return context[left] if op == nil
left, right = context[left], context[right]
left = context[left]
right = context[right]
operation = self.class.operators[op] || raise(Liquid::ArgumentError.new("Unknown operator #{op}"))

View File

@@ -36,7 +36,8 @@ module Liquid
def lax_parse(markup)
@filters = []
if markup =~ /(#{QuotedFragment})(.*)/om
name_markup, filter_markup = $1, $2
name_markup = $1
filter_markup = $2
@name = Expression.parse(name_markup)
if filter_markup =~ /#{FilterSeparator}\s*(.*)/om
filters = $1.scan(FilterParser)

View File

@@ -57,7 +57,8 @@ class StrainerUnitTest < Minitest::Test
end
def test_strainer_uses_a_class_cache_to_avoid_method_cache_invalidation
a, b = Module.new, Module.new
a = Module.new
b = Module.new
strainer = Strainer.create(nil, [a,b])
assert_kind_of Strainer, strainer
assert_kind_of a, strainer