2016-08-24 12:49:21 +05:30
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
|
|
|
module Node
|
|
|
|
module Validatable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
|
|
|
def validator
|
2016-09-13 17:45:13 +05:30
|
|
|
@validator ||= Class.new(Node::Validator).tap do |validator|
|
|
|
|
if defined?(@validations)
|
|
|
|
@validations.each { |rules| validator.class_eval(&rules) }
|
|
|
|
end
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def validations(&block)
|
|
|
|
(@validations ||= []).append(block)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|