Module: AtlasEngine::CountryProfile::Backend

Extended by:
FrozenRecord::Backends::Yaml, T::Sig
Defined in:
app/models/atlas_engine/country_profile.rb

Class Method Summary collapse

Class Method Details

.load(_file_path) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'app/models/atlas_engine/country_profile.rb', line 17

def load(_file_path)
  # FrozenRecord's default is to operate on a single YAML file containing all the records.
  # A custom backend like ours, that uses separate files, must load all of them and return an array.
  country_profiles = load_and_merge_fragments(CountryProfile.country_paths)
  locale_profiles = load_and_merge_fragments(CountryProfile.locale_paths)

  # These hashes are not complete country profiles, but rather fragments that will be merged
  # onto the default profile template.
  country_profiles + localize_profiles(country_profiles, locale_profiles)
end