Welcome to mirror list, hosted at ThFree Co, Russian Federation.

validatable.rb « node « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f6e2896dfb23ce2760a62aa46f50a1dbc5ba15e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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