Class: Gitlab::Ci::Build::Rules::Rule::Clause::If

Inherits:
Gitlab::Ci::Build::Rules::Rule::Clause show all
Defined in:
lib/gitlab/ci/build/rules/rule/clause/if.rb

Constant Summary

Constants inherited from Gitlab::Ci::Build::Rules::Rule::Clause

UnknownClauseError

Instance Method Summary collapse

Methods inherited from Gitlab::Ci::Build::Rules::Rule::Clause

fabricate

Constructor Details

#initialize(expression) ⇒ If

Returns a new instance of If.


7
8
9
# File 'lib/gitlab/ci/build/rules/rule/clause/if.rb', line 7

def initialize(expression)
  @expression = expression
end

Instance Method Details

#satisfied_by?(pipeline, context) ⇒ Boolean

Returns:

  • (Boolean)

11
12
13
14
# File 'lib/gitlab/ci/build/rules/rule/clause/if.rb', line 11

def satisfied_by?(pipeline, context)
  ::Gitlab::Ci::Pipeline::Expression::Statement.new(
    @expression, context.variables).truthful?
end