Class: UffizziCore::ComposeFile::ServicesOptions::EnvironmentService

Inherits:
Object
  • Object
show all
Extended by:
VariablesService
Defined in:
app/services/uffizzi_core/compose_file/services_options/environment_service.rb

Class Method Summary collapse

Methods included from VariablesService

build_variable, parse_variable_from_array, parse_variable_from_string

Class Method Details

.parse(environment) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/services/uffizzi_core/compose_file/services_options/environment_service.rb', line 7

def parse(environment)
  return [] if environment.blank?

  case environment
  when Array
    environment.map { |variable| parse_variable_from_string(variable) }
  when Hash
    environment.to_a.map { |variable| parse_variable_from_array(variable) }
  else
    raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_type', option: :environment)
  end
end