gitlab-org--gitlab-foss/lib/gitlab/ci/config/node/validatable.rb
2016-06-17 11:23:16 +02:00

29 lines
588 B
Ruby

module Gitlab
module Ci
class Config
module Node
module Validatable
extend ActiveSupport::Concern
class_methods do
def validator
validator = Class.new(Node::Validator)
if defined?(@validations)
@validations.each { |rules| validator.class_eval(&rules) }
end
validator
end
private
def validations(&block)
(@validations ||= []).append(block)
end
end
end
end
end
end
end