Class: Gitlab::Ci::Pipeline::Expression::Lexeme::Equals

Inherits:
LogicalOperator show all
Defined in:
lib/gitlab/ci/pipeline/expression/lexeme/equals.rb

Constant Summary collapse

PATTERN =
/==/.freeze

Constants inherited from Operator

Operator::OperatorError

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LogicalOperator

#initialize, #inspect, type

Methods inherited from Operator

type

Methods inherited from Base

consume?, #name, pattern, scan

Constructor Details

This class inherits a constructor from Gitlab::Ci::Pipeline::Expression::Lexeme::LogicalOperator

Class Method Details

.build(_value, behind, ahead) ⇒ Object


15
16
17
# File 'lib/gitlab/ci/pipeline/expression/lexeme/equals.rb', line 15

def self.build(_value, behind, ahead)
  new(behind, ahead)
end

.precedenceObject


19
20
21
# File 'lib/gitlab/ci/pipeline/expression/lexeme/equals.rb', line 19

def self.precedence
  10 # See: https://ruby-doc.org/core-2.5.0/doc/syntax/precedence_rdoc.html
end

Instance Method Details

#evaluate(variables = {}) ⇒ Object


11
12
13
# File 'lib/gitlab/ci/pipeline/expression/lexeme/equals.rb', line 11

def evaluate(variables = {})
  @left.evaluate(variables) == @right.evaluate(variables)
end