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


340
341
342
343
344
# File 'lib/gitlab/config/entry/validators.rb', line 340

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