class TwitterCldr::Resources::TerritoriesImporter
Constants
- Territories
Private Instance Methods
execute()
click to toggle source
# File lib/twitter_cldr/resources/territories_importer.rb, line 22 def execute params[:locales].each do |locale| import_locale(locale) end end
import_locale(locale)
click to toggle source
# File lib/twitter_cldr/resources/territories_importer.rb, line 28 def import_locale(locale) data = requirements[:cldr].merge_each_ancestor(locale) do |ancestor_locale| TerritoryData.new(ancestor_locale, requirements[:cldr]).to_h end output_file = File.join(output_path, locale.to_s, 'territories.yml') File.open(output_file, 'w:utf-8') do |output| output.write( TwitterCldr::Utils::YAML.dump( TwitterCldr::Utils.deep_symbolize_keys(locale => data), use_natural_symbols: true ) ) end end
output_path()
click to toggle source
# File lib/twitter_cldr/resources/territories_importer.rb, line 45 def output_path params.fetch(:output_path) end