Class: TwitterCldr::Resources::TimezoneTestsImporter

Inherits:
Importer
  • Object
show all
Defined in:
lib/twitter_cldr/resources/timezone_tests_importer.rb

Constant Summary collapse

TEST_TIME =
Time.utc(2019, 11, 17, 0, 0, 0)
TYPES =
[
  :LOCALIZED_GMT,
  :LOCALIZED_GMT_SHORT,
  :GENERIC_LOCATION,
  :GENERIC_LONG,
  :GENERIC_SHORT,
  :SPECIFIC_LONG,
  :SPECIFIC_SHORT,
  :ISO_BASIC_SHORT,
  :ISO_BASIC_LOCAL_SHORT,
  :ISO_BASIC_FIXED,
  :ISO_BASIC_LOCAL_FIXED,
  :ISO_BASIC_FULL,
  :ISO_BASIC_LOCAL_FULL,
  :ISO_EXTENDED_FIXED,
  :ISO_EXTENDED_LOCAL_FIXED,
  :ISO_EXTENDED_FULL,
  :ISO_EXTENDED_LOCAL_FULL,
  :ZONE_ID_SHORT,
  :EXEMPLAR_LOCATION
]

Constants inherited from Importer

Importer::DEFAULT_ENGINE

Instance Attribute Summary

Attributes inherited from Importer

#params, #requirements

Instance Method Summary collapse

Methods inherited from Importer

#can_import?, default_params, #import, #initialize, locales, output_path, parameter, parameters, #prepare, requirement, requirements, ruby_engine

Constructor Details

This class inherits a constructor from TwitterCldr::Resources::Importer

Instance Method Details

#executeObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/twitter_cldr/resources/timezone_tests_importer.rb', line 43

def execute
  check_tzdata_versions

  output_path = params.fetch(:output_path)
  FileUtils.mkdir_p(output_path)

  params[:locales].each do |locale|
    output_file = File.join(output_path, "#{locale}.yml")

    File.write(
      output_file, YAML.dump(generate_test_cases_for_locale(locale))
    )
  end
end