2019-08-06 17:54:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Una lista de valores
|
|
|
|
class MetadataArray < MetadataTemplate
|
|
|
|
# El valor por defecto es una array vacía
|
|
|
|
def default_value
|
2020-11-11 18:29:12 +00:00
|
|
|
super || []
|
2019-08-06 17:54:17 +00:00
|
|
|
end
|
2019-08-13 23:33:57 +00:00
|
|
|
|
2021-02-11 15:13:18 +00:00
|
|
|
# Los Arrays no se pueden cifrar todavía
|
|
|
|
# TODO: Cifrar y decifrar arrays
|
|
|
|
def private?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2020-02-12 21:24:54 +00:00
|
|
|
private
|
|
|
|
|
2021-02-11 19:16:25 +00:00
|
|
|
# TODO: Sanitizar otros valores
|
|
|
|
# XXX: Por qué eliminamos el punto del final?
|
2020-02-12 21:24:54 +00:00
|
|
|
def sanitize(values)
|
|
|
|
values.map do |v|
|
2021-02-11 19:16:25 +00:00
|
|
|
case v
|
|
|
|
when String then super(v).sub(/\.\z/, '')
|
|
|
|
else v
|
2020-02-12 21:24:54 +00:00
|
|
|
end
|
2021-02-11 15:13:18 +00:00
|
|
|
end.select(&:present?)
|
2020-02-12 21:24:54 +00:00
|
|
|
end
|
2019-08-06 17:54:17 +00:00
|
|
|
end
|