Class: UniProp::PropFile::UnihanFile

Inherits:
UniProp::PropFile show all
Defined in:
lib/uniprop/unicode_elements.rb

Instance Attribute Summary

Attributes inherited from UniProp::PropFile

#basename_prefix, #split_regexp, #strip_regexp, #version

Instance Method Summary collapse

Methods inherited from UniProp::PropFile

#==, #actual_properties, #cache_path, #column_size, #comment?, #comment_ranges, #contents, #has_property_alias?, #information_containing_ranges, #inspect, #is_derived?, #is_meta_file?, #lines, #lines_without_comment, #max_column_size, #missing_value_lines, #netto_lines, #netto_shaped_lines, #property_alias_including_ranges, #property_value_type_match?, #property_value_type_match_ranges, #propfile_value_group, #shaped_lines, #shaped_missing_value_lines, #type_match?, #unique_column?, #value_at, #values, #verbose_property_value_type_match_ranges

Constructor Details

#initialize(cache_path, version, strip_regexp: nil, split_regexp: nil) ⇒ UnihanFile

Returns a new instance of UnihanFile.



569
570
571
572
573
574
575
576
577
578
# File 'lib/uniprop/unicode_elements.rb', line 569

def initialize(cache_path, version, strip_regexp: nil, split_regexp: nil)
  if !strip_regexp || !split_regexp
    # strip_regexp, split_regexpが引数で指定されていない場合、settings.rbの記述を使用
    file_format = version.prop_data.settings.unihan_file_format(version.version_name)
    
    strip_regexp ||= file_format[:strip]
    split_regexp ||= file_format[:split]
  end
  super(cache_path, version, strip_regexp: strip_regexp, split_regexp: split_regexp)
end

Instance Method Details

#download_myselfObject

Unihanの場合はファイル名とパスが一致せず、Unihan.zipに記述されているため、Unihan.zipをダウンロード・展開



581
582
583
584
# File 'lib/uniprop/unicode_elements.rb', line 581

def download_myself
  UniPropUtils::DownloaderWrapper.download_unihan(version.version_name, version.cache_path.parent)
  UniPropUtils::FileManager.recursive_unzip(version.file_cache_paths)
end

#is_unihan_file?Boolean

Returns:

  • (Boolean)


586
# File 'lib/uniprop/unicode_elements.rb', line 586

def is_unihan_file?() true end