Class: UniProp::EfficientVersion

Inherits:
Version
  • Object
show all
Defined in:
lib/uniprop/efficient_elements.rb,
lib/uniprop/inspects.rb

Overview

完全なメタデータが存在する事を前提とし、必要なファイルをキャッシュにダウンロードしてVersionと同じ動きをするクラス

Instance Attribute Summary

Attributes inherited from Version

#cache_path, #directory, #excluded_directories, #excluded_extensions, #excluded_files, #included_files, #major, #minor, #prop_data, #property_aliases_file_name, #property_value_aliases_file_name, #tiny, #unicode_beta, #version_name

Instance Method Summary collapse

Methods inherited from Version

#<=>, #cache_files, #convert_property, #download_file, #download_version_files, #file_cache_paths, #find_cache_file_path, #find_property, #find_unihan_property, #has_cache_file?, #has_file?, #has_property?, #has_unihan?, #has_unihan_property?, #has_version_metadata?, #initialize, name_to_weight, parse, #properties, #property_aliases_file, #property_to_miscellaneous_formats, #property_to_property_values, #property_value_aliases_file, #unihan_files, #unihanprop, #version_metadata, #weight

Constructor Details

This class inherits a constructor from UniProp::Version

Instance Method Details

#create_propfile(filename) ⇒ PropFile

Parameters:

  • filename (String)

    basename_prefixに該当するファイル名

Returns:



32
33
34
35
36
37
38
# File 'lib/uniprop/efficient_elements.rb', line 32

def create_propfile(filename)
  if UniPropUtils::FileManager.unihan_file?(filename, unihan_file_names)
    return PropFile::UnihanFile.new(filename, self)
  else
    return PropFile.new(filename, self)
  end
end

#filesSet<PropFile>

Returns:



5
6
7
8
9
10
11
12
13
# File 'lib/uniprop/efficient_elements.rb', line 5

def files
  return @files if @files
  @files = .propfile_names.map { create_propfile(_1) }

  # PropertyAliases, PropertyValueAliasesはメタデータに記述されない
  @files << property_aliases_file
  @files << property_value_aliases_file
  @files
end

#find_file(propfile) ⇒ PropFile

Returns:



26
27
28
# File 'lib/uniprop/efficient_elements.rb', line 26

def find_file(propfile)
  super(propfile, confirm: false)
end

#inspectObject



19
20
21
# File 'lib/uniprop/inspects.rb', line 19

def inspect
  "#<#{self.class} #{.version.version_name}>"
end

#unihan_file_namesArray<String>?

Returns:

  • (Array<String>?)


16
17
18
# File 'lib/uniprop/efficient_elements.rb', line 16

def unihan_file_names
  .unihan_file_names
end

#unihan_propertiesArray<Property>

Returns:



21
22
23
# File 'lib/uniprop/efficient_elements.rb', line 21

def unihan_properties
  .unihan_properties
end