Sha256: ae90299751147684a9d2a10afc3b3ef9b721f6ac64390bda32fabcc4aa44f03f
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
module Cucumber module TagExpressions # Literal expression node class Literal def initialize(value) @value = value end def evaluate(variables) variables.include?(@value) end def to_s @value.gsub(/\\/, "\\\\\\\\").gsub(/\(/, "\\(").gsub(/\)/, "\\)") end end # Not expression node class Not def initialize(expression) @expression = expression end def evaluate(variables) !@expression.evaluate(variables) end def to_s "not ( #{@expression} )" end end # Or expression node class Or def initialize(left, right) @left = left @right = right end def evaluate(variables) @left.evaluate(variables) || @right.evaluate(variables) end def to_s "( #{@left} or #{@right} )" end end # And expression node class And def initialize(left, right) @left = left @right = right end def evaluate(variables) @left.evaluate(variables) && @right.evaluate(variables) end def to_s "( #{@left} and #{@right} )" end end end end
Version data entries
7 entries across 7 versions & 4 rubygems