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
|
|
|
|
|
|
|
|
def sanitize(values)
|
|
|
|
values.map do |v|
|
|
|
|
if v.is_a? String
|
2020-04-15 13:13:38 +00:00
|
|
|
super(v).sub(/\.\z/, '')
|
2020-02-12 21:24:54 +00:00
|
|
|
else
|
|
|
|
v
|
|
|
|
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
|