2016-11-14 03:56:39 +00:00
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
2016-11-18 03:42:35 +00:00
|
|
|
module Entry
|
2016-11-14 03:56:39 +00:00
|
|
|
##
|
|
|
|
# Entry that represents a Regular Expression.
|
|
|
|
#
|
2016-11-18 03:42:35 +00:00
|
|
|
class Coverage < Node
|
2016-11-14 03:56:39 +00:00
|
|
|
include Validatable
|
|
|
|
|
2016-11-20 00:48:02 +00:00
|
|
|
ALLOWED_KEYS = %i[output_filter]
|
|
|
|
|
2016-11-14 03:56:39 +00:00
|
|
|
validations do
|
2016-11-20 00:48:02 +00:00
|
|
|
validates :config, type: Hash
|
|
|
|
validates :config, allowed_keys: ALLOWED_KEYS
|
|
|
|
validates :output_filter, regexp: true
|
2016-11-14 03:56:39 +00:00
|
|
|
end
|
|
|
|
|
2016-11-20 00:48:02 +00:00
|
|
|
def output_filter
|
|
|
|
output_filter_value = @config[:output_filter].to_s
|
|
|
|
|
|
|
|
if output_filter_value.start_with?('/') && output_filter_value.end_with?('/')
|
|
|
|
output_filter_value[1...-1]
|
2016-11-14 03:56:39 +00:00
|
|
|
else
|
2016-11-21 04:38:03 +00:00
|
|
|
@config[:output_filter]
|
2016-11-14 03:56:39 +00:00
|
|
|
end
|
|
|
|
end
|
2016-11-20 00:48:02 +00:00
|
|
|
|
|
|
|
def value
|
|
|
|
@config.merge(output_filter: output_filter)
|
|
|
|
end
|
2016-11-14 03:56:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|