blob: 83bca0d08bc6bda32ff0f566a5bed4a818b89969 (
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
30
31
32
33
34
35
36
37
|
module Gitlab
module Ci
class Config
module Entry
class Validator < SimpleDelegator
include ActiveModel::Validations
include Entry::Validators
def initialize(entry)
super(entry)
@entry = entry
end
def messages
errors.full_messages.map do |error|
"#{location} #{error}".downcase
end
end
def self.name
'Validator'
end
private
def location
ancestors.map(&:key).compact.append(key_name).join(':')
end
def key_name
key.presence || @entry.class.name.to_s.demodulize.underscore.humanize
end
end
end
end
end
end
|