Class: UniProp::PropFile::PropertyAliases

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, #download_myself, #has_property_alias?, #information_containing_ranges, #initialize, #inspect, #is_derived?, #is_unihan_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

This class inherits a constructor from UniProp::PropFile

Instance Method Details

#is_meta_file?Boolean

Returns:

  • (Boolean)


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

def is_meta_file?() true; end

#property_value_type_to_shaped_linesHash<String, Set<Array<String>>>

PropertyAliasesを解析し、タイプとプロパティの関係を取得

Returns:

  • (Hash<String, Set<Array<String>>>)


530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/uniprop/unicode_elements.rb', line 530

def property_value_type_to_shaped_lines
  return @property_type_to_shaped_lines if @property_type_to_shaped_lines

  @property_type_to_shaped_lines = Hash.new { |hash, key| hash[key]=Set.new }
  mps = UniPropUtils::FileRegexp.matched_positions(cache_path.read, /#\s*={10,}\n#\s(.+)\sProperties\n#\s*={10,}/)

  mps.size.times do |i|
    mp = mps[i]
    next_mp = mps[i+1]
   
    begin_i = mp[:end_col] + 1
    end_i = next_mp ? next_mp[:begin_col] : lines.size
    
    property_type = mp[:match_data][1]

    (begin_i...end_i).each { @property_type_to_shaped_lines[property_type] << shaped_lines[_1] if !shaped_lines[_1].empty?}
  end

  @property_type_to_shaped_lines
end