mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 20:56:08 +10:00
28 lines
765 B
Ruby
28 lines
765 B
Ruby
module Gitlab
|
|
module Ci
|
|
class Config
|
|
module Node
|
|
module Validators
|
|
class ArrayOfStringsValidator < ActiveModel::EachValidator
|
|
include LegacyValidationHelpers
|
|
|
|
def validate_each(record, attribute, value)
|
|
unless validate_array_of_strings(value)
|
|
record.errors.add(attribute, 'should be an array of strings')
|
|
end
|
|
end
|
|
end
|
|
|
|
class HashValidator < ActiveModel::EachValidator
|
|
def validate_each(record, attribute, value)
|
|
unless value.is_a?(Hash)
|
|
record.errors.add(attribute, 'should be a configuration entry hash')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|