From 37260f17ffe660be61925f9ce7c1cd7c8ee49dd9 Mon Sep 17 00:00:00 2001 From: Dylan Thacker-Smith Date: Wed, 23 Jul 2014 01:18:45 -0400 Subject: [PATCH] Use Expression.parse and Context#evaluate in the Condition class. --- lib/liquid/condition.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/liquid/condition.rb b/lib/liquid/condition.rb index d6dec68..867c1ee 100644 --- a/lib/liquid/condition.rb +++ b/lib/liquid/condition.rb @@ -28,9 +28,9 @@ module Liquid attr_accessor :left, :operator, :right def initialize(left = nil, operator = nil, right = nil) - @left = left + @left = Expression.parse(left) @operator = operator - @right = right + @right = Expression.parse(right) @child_relation = nil @child_condition = nil end @@ -96,10 +96,10 @@ module Liquid # If the operator is empty this means that the decision statement is just # a single variable. We can just poll this variable from the context and # return this as the result. - return context[left] if op == nil + return context.evaluate(left) if op == nil - left = context[left] - right = context[right] + left = context.evaluate(left) + right = context.evaluate(right) operation = self.class.operators[op] || raise(Liquid::ArgumentError.new("Unknown operator #{op}"))