2020-03-25 19:46:16 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Una lista de valores predefinidos
|
|
|
|
class MetadataPredefinedArray < MetadataArray
|
|
|
|
def values
|
2021-03-03 12:43:15 +00:00
|
|
|
@values ||= layout.dig(:metadata, name, 'values')&.map do |k, v|
|
2020-11-07 23:51:00 +00:00
|
|
|
[v[I18n.locale.to_s], k]
|
2021-03-03 12:43:15 +00:00
|
|
|
end&.to_h
|
2020-03-25 19:46:16 +00:00
|
|
|
end
|
2024-07-02 16:01:13 +00:00
|
|
|
|
|
|
|
# Devolver los valores legibles por humanes
|
|
|
|
#
|
|
|
|
# @todo Debería devolver los valores en el idioma del post, no de le
|
|
|
|
# usuarie
|
|
|
|
# @return [String]
|
|
|
|
def to_s
|
|
|
|
values.invert.select { |x, k| value.include?(x) }.values.join(', ')
|
|
|
|
end
|
2020-03-25 19:46:16 +00:00
|
|
|
end
|