Module: Ucode::Fetch::UcdZip
- Defined in:
- lib/ucode/fetch/ucd_zip.rb
Overview
Downloads UCD.zip from unicode.org and unpacks it into ‘Cache.ucd_dir(version)`.
Class Method Summary collapse
-
.call(version, force: false) ⇒ Pathname
The ucd_dir after extraction.
Class Method Details
.call(version, force: false) ⇒ Pathname
Returns the ucd_dir after extraction.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ucode/fetch/ucd_zip.rb', line 17 def call(version, force: false) Cache.ensure_version_dir!(version) target_dir = Cache.ucd_dir(version) marker = target_dir.join("UnicodeData.txt") return target_dir if marker.exist? && !force url = "#{Ucode.configuration.ucd_base_url}/#{version}#{URL_SUFFIX}" zip_path = Cache.version_dir(version).join("ucd.zip") Http.get(url, dest: zip_path) extract(zip_path, target_dir) zip_path.delete if zip_path.exist? target_dir end |