Class: UniProp::PropFileMetaData
- Inherits:
-
Object
- Object
- UniProp::PropFileMetaData
- Defined in:
- lib/uniprop/inspects.rb,
lib/uniprop/metadata_processor.rb
Instance Attribute Summary collapse
-
#propfile ⇒ Object
readonly
Returns the value of attribute propfile.
-
#raw_file_format ⇒ Object
readonly
Returns the value of attribute raw_file_format.
Instance Method Summary collapse
-
#actual_properties ⇒ Array<Property>
ファイル内に含まれるプロパティを取得.
-
#block_value_group(block_no) ⇒ Object
block_no番目のブロックに関するBlockValueGroupオブジェクトを取得.
- #blocks ⇒ Array<Block>
-
#codepoint_column_nos ⇒ Array<Integer?>
各ブロックの、codepointが記述されている列番号を取得.
-
#has_any_properties? ⇒ Boolean
:nocov: ファイル内にプロパティが1つ以上含まれるかを判定.
-
#has_multiple_properties_column? ⇒ Boolean
propfile内に複数のプロパティを含む列が存在するかを判定.
-
#initialize(propfile, raw_file_format) ⇒ PropFileMetaData
constructor
A new instance of PropFileMetaData.
- #inspect ⇒ Object
-
#property_column_nos(prop) ⇒ Array<Array<Integer>>
各ブロックの、propが記述されている列番号を取得.
-
#property_written_ranges ⇒ Array<Range<Integer>>
プロパティが記述されている範囲を取得.
-
#raw_blocks ⇒ Array<RawBlock>
raw_file_formatからRawBlockオブジェクトを作成.
-
#version ⇒ Version
:nocov:.
-
#version_metadata ⇒ VersionMetaData
:nocov:.
Constructor Details
#initialize(propfile, raw_file_format) ⇒ PropFileMetaData
Returns a new instance of PropFileMetaData.
384 385 386 387 |
# File 'lib/uniprop/metadata_processor.rb', line 384 def initialize(propfile, raw_file_format) @propfile = propfile @raw_file_format = raw_file_format end |
Instance Attribute Details
#propfile ⇒ Object (readonly)
Returns the value of attribute propfile.
382 383 384 |
# File 'lib/uniprop/metadata_processor.rb', line 382 def propfile @propfile end |
#raw_file_format ⇒ Object (readonly)
Returns the value of attribute raw_file_format.
382 383 384 |
# File 'lib/uniprop/metadata_processor.rb', line 382 def raw_file_format @raw_file_format end |
Instance Method Details
#actual_properties ⇒ Array<Property>
ファイル内に含まれるプロパティを取得
414 415 416 417 418 419 420 421 422 |
# File 'lib/uniprop/metadata_processor.rb', line 414 def actual_properties return @actual_properties if @actual_properties @actual_properties = [] blocks.each { @actual_properties.concat(_1.content.flatten.compact) } @actual_properties.uniq! @actual_properties end |
#block_value_group(block_no) ⇒ Object
block_no番目のブロックに関するBlockValueGroupオブジェクトを取得
487 488 489 490 491 492 |
# File 'lib/uniprop/metadata_processor.rb', line 487 def block_value_group(block_no) return nil if block_no<0 || blocks.size<=block_no @block_value_groups ||= {} @block_value_groups[block_no] ||= BlockValueGroup.new(propfile, block_no) @block_value_groups[block_no] end |
#blocks ⇒ Array<Block>
399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/uniprop/metadata_processor.rb', line 399 def blocks return @blocks if @blocks @blocks = [] raw_blocks.each do |raw_block| content = version.convert_property(raw_block.content) range = UniPropUtils::RangeProcessor.str_to_range(raw_block.range) @blocks << Block.new(content, range) end @blocks end |
#codepoint_column_nos ⇒ Array<Integer?>
各ブロックの、codepointが記述されている列番号を取得
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/uniprop/metadata_processor.rb', line 439 def codepoint_column_nos return @codepoint_column_nos if @codepoint_column_nos @codepoint_column_nos = Array.new(raw_blocks.size) raw_blocks.each_with_index do |raw_block, block_no| raw_block.content.each_with_index do |col, col_no| if ( col.class==Array && col.map{Alias.canonical(_1)}.include?("codepoint") || col.class==String && Alias.canonical(col)=="codepoint" ) @codepoint_column_nos[block_no] = col_no end end end @codepoint_column_nos end |
#has_any_properties? ⇒ Boolean
:nocov: ファイル内にプロパティが1つ以上含まれるかを判定
432 433 434 |
# File 'lib/uniprop/metadata_processor.rb', line 432 def has_any_properties? !actual_properties.empty? end |
#has_multiple_properties_column? ⇒ Boolean
propfile内に複数のプロパティを含む列が存在するかを判定
478 479 480 481 482 483 |
# File 'lib/uniprop/metadata_processor.rb', line 478 def has_multiple_properties_column? blocks.each do |block| return true if block.content.any? { _1.class==Array } end return false end |
#inspect ⇒ Object
63 64 65 |
# File 'lib/uniprop/inspects.rb', line 63 def inspect "#<#{self.class.name} #{propfile.basename_prefix}>" end |
#property_column_nos(prop) ⇒ Array<Array<Integer>>
各ブロックの、propが記述されている列番号を取得
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/uniprop/metadata_processor.rb', line 460 def property_column_nos(prop) property_column_nos = Array.new(blocks.size) { [] } blocks.each_with_index do |block, block_no| block.content.each_with_index do |col, col_no| if ( col.class==Array && col.include?(prop) || col.class==Property && col==prop ) property_column_nos[block_no] << col_no end end end property_column_nos end |
#property_written_ranges ⇒ Array<Range<Integer>>
プロパティが記述されている範囲を取得
426 427 428 |
# File 'lib/uniprop/metadata_processor.rb', line 426 def property_written_ranges @property_written_ranges ||= blocks.map { _1.range } end |
#raw_blocks ⇒ Array<RawBlock>
raw_file_formatからRawBlockオブジェクトを作成
391 392 393 394 395 396 |
# File 'lib/uniprop/metadata_processor.rb', line 391 def raw_blocks return @raw_blocks if @raw_blocks @raw_blocks = [] raw_file_format["blocks"].each { @raw_blocks << RawBlock.new(_1["content"], _1["range"])} @raw_blocks end |
#version ⇒ Version
:nocov:
503 504 505 |
# File 'lib/uniprop/metadata_processor.rb', line 503 def version propfile.version end |
#version_metadata ⇒ VersionMetaData
:nocov:
496 497 498 |
# File 'lib/uniprop/metadata_processor.rb', line 496 def propfile.version. end |