Class: Gitlab::Config::Entry::Validators::ExpressionValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/gitlab/config/entry/validators.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


296
297
298
299
300
# File 'lib/gitlab/config/entry/validators.rb', line 296

def validate_each(record, attribute, value)
  unless value.is_a?(String) && ::Gitlab::Ci::Pipeline::Expression::Statement.new(value).valid?
    record.errors.add(attribute, 'Invalid expression syntax')
  end
end