Class: UniProp::VersionPropertyMetaData
- Inherits:
-
Object
- Object
- UniProp::VersionPropertyMetaData
- Defined in:
- lib/uniprop/inspects.rb,
lib/uniprop/metadata_processor.rb
Instance Attribute Summary collapse
-
#raw_metadata ⇒ Object
readonly
Returns the value of attribute raw_metadata.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #find_property_data(property) ⇒ PropertyData
-
#initialize(version, raw_metadata) ⇒ VersionPropertyMetaData
constructor
A new instance of VersionPropertyMetaData.
- #inspect ⇒ Object
-
#property_datas ⇒ Array<Hash<String,Object>>
プロパティ中心のメタデータのproperties項をUniPropのデータ構造に変換して取得.
Constructor Details
#initialize(version, raw_metadata) ⇒ VersionPropertyMetaData
Returns a new instance of VersionPropertyMetaData.
574 575 576 577 |
# File 'lib/uniprop/metadata_processor.rb', line 574 def initialize(version, ) @version = version @raw_metadata = end |
Instance Attribute Details
#raw_metadata ⇒ Object (readonly)
Returns the value of attribute raw_metadata.
570 571 572 |
# File 'lib/uniprop/metadata_processor.rb', line 570 def @raw_metadata end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
570 571 572 |
# File 'lib/uniprop/metadata_processor.rb', line 570 def version @version end |
Instance Method Details
#find_property_data(property) ⇒ PropertyData
610 611 612 613 614 615 616 617 |
# File 'lib/uniprop/metadata_processor.rb', line 610 def find_property_data(property) prop = property_datas.find { _1.property==property } if prop return prop else raise MetaDataNotFoundError, "MetaData for #{property.longest_alias} is not found." end end |
#inspect ⇒ Object
105 106 107 |
# File 'lib/uniprop/inspects.rb', line 105 def inspect "#<#{self.class.name}>" end |
#property_datas ⇒ Array<Hash<String,Object>>
プロパティ中心のメタデータのproperties項をUniPropのデータ構造に変換して取得
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/uniprop/metadata_processor.rb', line 581 def property_datas return @property_datas if @property_datas @property_datas = [] ["properties"].each do |raw_prop_data| positions = [] raw_prop_data["positions"].each do |raw_position| positions << Position.new( version.find_file(raw_position["file_name"]), UniPropUtils::RangeProcessor.str_to_range(raw_position["range"]), raw_position["block"], raw_position["columns"], ) end @property_datas << PropertyData.new( version.find_property(raw_prop_data["property_name"]), positions, raw_prop_data["unihan"], raw_prop_data["derived"], ) end @property_datas end |