Class: Gitlab::Ci::Pipeline::Expression::Lexeme::Matches
Constant Summary
collapse
- PATTERN =
/=~/
Constants inherited
from Operator
Operator::OperatorError
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, #inspect, type
Methods inherited from Operator
type
Methods inherited from Base
consume?, #name, pattern, scan
Class Method Details
.build(_value, behind, ahead) ⇒ Object
24
25
26
|
# File 'lib/gitlab/ci/pipeline/expression/lexeme/matches.rb', line 24
def self.build(_value, behind, ahead)
new(behind, ahead)
end
|
.precedence ⇒ Object
28
29
30
|
# File 'lib/gitlab/ci/pipeline/expression/lexeme/matches.rb', line 28
def self.precedence
10 end
|
Instance Method Details
#evaluate(variables = {}) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/gitlab/ci/pipeline/expression/lexeme/matches.rb', line 11
def evaluate(variables = {})
text = @left.evaluate(variables)
regexp = @right.evaluate(variables)
return false unless regexp
regexp = Lexeme::Pattern.build_and_evaluate(regexp, variables)
regexp.scan(text.to_s).present?
end
|