Class: Ucode::Commands::CacheCommand
- Inherits:
-
Object
- Object
- Ucode::Commands::CacheCommand
- Defined in:
- lib/ucode/commands/cache.rb
Overview
‘ucode cache` — inspect and manage the on-disk cache. Three subactions: list, info, remove.
Instance Method Summary collapse
-
#info(version) ⇒ VersionInfo?
Nil if version not in cache.
-
#list ⇒ Array<String>
Sorted versions present in the cache.
-
#remove(version) ⇒ Boolean
True if a directory was removed.
Instance Method Details
#info(version) ⇒ VersionInfo?
Returns nil if version not in cache.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ucode/commands/cache.rb', line 23 def info(version) return nil unless Cache.cached?(version) VersionInfo.new( version: version, path: Cache.version_dir(version), has_ucd: Cache.ucd_dir(version).join("UnicodeData.txt").exist?, has_unihan: Cache.unihan_dir(version).children.any?, has_pdfs: Cache.pdfs_dir(version).children.any?, has_sqlite: Cache.sqlite_path(version).exist?, ) end |
#list ⇒ Array<String>
Returns sorted versions present in the cache.
17 18 19 |
# File 'lib/ucode/commands/cache.rb', line 17 def list Cache.cached_versions end |
#remove(version) ⇒ Boolean
Returns true if a directory was removed.
38 39 40 41 42 43 |
# File 'lib/ucode/commands/cache.rb', line 38 def remove(version) return false unless Cache.cached?(version) Cache.remove_version(version) true end |