11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/services/uffizzi_core/compose_file/parsers/services/volumes_parser_service.rb', line 11
def parse(volumes, additional_data)
return [] if volumes.blank?
if volumes.is_a?(String)
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.volumes_should_be_array', volumes: volumes)
end
volumes.map do |volume|
volume_data = case volume
when String
process_short_syntax(volume, additional_data)
when Hash
process_long_syntax(volume, additional_data)
else
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_type', option: :volumes)
end
volume_data
end.uniq
end
|