Commit 34bebde8 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add base classes to evaluate variables expressions

parent 4efcc061
module Gitlab
module Ci
module Pipeline
module Expression
class Equality
PATTERN = /==/.freeze
def initialize(left, right)
end
def evaluate(**variables)
@left.evaluate(variables) == @right.evaluate(variables)
end
def self.build(string)
end
end
end
end
end
end
module Gitlab
module Ci
module Pipeline
module Expression
class Lexer
def initialize(statement)
@statement = statement
end
def tokenize
end
end
end
end
end
end
...@@ -8,10 +8,10 @@ module Gitlab ...@@ -8,10 +8,10 @@ module Gitlab
@statement = statement @statement = statement
end end
def errors def variables
end end
def matches? def evaluate
end end
end end
end end
......
module Gitlab
module Ci
module Pipeline
module Expression
class String
PATTERN = /("|')(?<value>.+)('|")/.freeze
def initialize(value)
@value = value
end
def evaluate(**_)
@value.to_s
end
def self.build(string)
end
end
end
end
end
end
module Gitlab
module Ci
module Pipeline
module Expression
class Equality
PATTERN = /$(?<name>\w+)/.freeze
def initialize(value)
@value = value
end
def evaluate(**variables)
end
def self.build(string)
end
end
end
end
end
end
require 'spec_helper'
describe Gitlab::Ci::Pipeline::Expression::Statement do
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment