Class: FlatApi::FlatLocales

Inherits:
Object
  • Object
show all
Defined in:
lib/flat_api/models/flat_locales.rb

Constant Summary collapse

EN =
"en".freeze
EN_GB =
"en-GB".freeze
ES =
"es".freeze
FR =
"fr".freeze
DE =
"de".freeze
IT =
"it".freeze
JA =
"ja".freeze
JA_HIRA =
"ja-HIRA".freeze
KO =
"ko".freeze
NL =
"nl".freeze
PL =
"pl".freeze
PT =
"pt".freeze
PT_BR =
"pt-BR".freeze
RO =
"ro".freeze
RU =
"ru".freeze
SV =
"sv".freeze
TR =
"tr".freeze
ZH_HANS =
"zh-Hans".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.all_varsObject



37
38
39
# File 'lib/flat_api/models/flat_locales.rb', line 37

def self.all_vars
  @all_vars ||= [EN, EN_GB, ES, FR, DE, IT, JA, JA_HIRA, KO, NL, PL, PT, PT_BR, RO, RU, SV, TR, ZH_HANS].freeze
end

.build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



44
45
46
# File 'lib/flat_api/models/flat_locales.rb', line 44

def self.build_from_hash(value)
  new.build_from_hash(value)
end

Instance Method Details

#build_from_hash(value) ⇒ String

Builds the enum from string

Parameters:

  • The (String)

    enum value in the form of the string

Returns:

  • (String)

    The enum value



51
52
53
54
# File 'lib/flat_api/models/flat_locales.rb', line 51

def build_from_hash(value)
  return value if FlatLocales.all_vars.include?(value)
  raise "Invalid ENUM value #{value} for class #FlatLocales"
end