Class: TwitterCldr::Shared::PropertySet

Inherits:
Object
  • Object
show all
Extended by:
SingleForwardable
Includes:
Properties, AdditionalPropertyMethods
Defined in:
lib/twitter_cldr/shared/property_set.rb

Overview

Note:

Properties are mostly accessed through the CodePoint class. PropertySet is used internally.

Defined Under Namespace

Modules: AdditionalPropertyMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties_hash) ⇒ PropertySet

Returns a new instance of PropertySet.



19
20
21
# File 'lib/twitter_cldr/shared/property_set.rb', line 19

def initialize(properties_hash)
  @properties_hash = properties_hash
end

Instance Attribute Details

#properties_hashObject (readonly)

Returns the value of attribute properties_hash.



15
16
17
# File 'lib/twitter_cldr/shared/property_set.rb', line 15

def properties_hash
  @properties_hash
end

Instance Method Details

#ageObject

Examples:

properties = TwitterCldr::Shared::CodePoint.get(12367).properties
properties.age # => #<Set: {"1.1"}>


26
27
28
# File 'lib/twitter_cldr/shared/property_set.rb', line 26

def age
  properties_hash.fetch('Age', ['Unassigned'])
end

#bidi_paired_bracket_typeObject



47
48
49
50
51
# File 'lib/twitter_cldr/shared/property_set.rb', line 47

def bidi_paired_bracket_type
  properties_hash['Bidi_Paired_Bracket_Type'] ||= [
    BidiBrackets.bracket_types['N']
  ]
end

#blockObject

Examples:

properties = TwitterCldr::Shared::CodePoint.get(0x200D).properties
properties.block # => #<Set: {"General Punctuation"}>


56
57
58
# File 'lib/twitter_cldr/shared/property_set.rb', line 56

def block
  properties_hash['Block'] ||= ['No_Block']
end

#east_asian_widthObject



60
61
62
# File 'lib/twitter_cldr/shared/property_set.rb', line 60

def east_asian_width
  properties_hash['East_Asian_Width'] ||= ['N']
end

#general_categoryObject



88
89
90
# File 'lib/twitter_cldr/shared/property_set.rb', line 88

def general_category
  properties_hash.fetch('General_Category', [])
end

#grapheme_cluster_breakObject



64
65
66
# File 'lib/twitter_cldr/shared/property_set.rb', line 64

def grapheme_cluster_break
  properties_hash['Grapheme_Cluster_Break'] ||= ['Other']
end

#hangul_syllable_typeObject



68
69
70
# File 'lib/twitter_cldr/shared/property_set.rb', line 68

def hangul_syllable_type
  properties_hash['Hangul_Syllable_Type'] ||= ['Not_Applicable']
end

#indic_positional_categoryObject



72
73
74
# File 'lib/twitter_cldr/shared/property_set.rb', line 72

def indic_positional_category
  properties_hash['Indic_Positional_Category'] ||= ['NA']
end

#indic_syllabic_categoryObject



76
77
78
# File 'lib/twitter_cldr/shared/property_set.rb', line 76

def indic_syllabic_category
  properties_hash['Indic_Syllabic_Category'] ||= ['Other']
end

#jamo_short_nameObject



80
81
82
# File 'lib/twitter_cldr/shared/property_set.rb', line 80

def jamo_short_name
  properties_hash['Jamo_Short_Name'] ||= ['<none>']
end

#joining_typeObject

Examples:

# ZERO WIDTH JOINER
properties = TwitterCldr::Shared::CodePoint.get(0x200D).properties
properties.joining_type # => #<Set: {"Join_Causing"}>
# SPACE
properties = TwitterCldr::Shared::CodePoint.get(32).properties
properties.joining_type # => ["Non_Joining", "Non_Joining"]


37
38
39
40
41
42
43
44
45
# File 'lib/twitter_cldr/shared/property_set.rb', line 37

def joining_type
  properties_hash['Joining_Type'] ||= if general_category.empty?
    [ArabicShaping.joining_type_for_general_category('xx')]
  else
    general_category.map do |gc|
      ArabicShaping.joining_type_for_general_category(gc)
    end
  end
end

#line_breakObject



84
85
86
# File 'lib/twitter_cldr/shared/property_set.rb', line 84

def line_break
  properties_hash['Line_Break'] ||= ['XX']
end

#scriptObject



96
97
98
# File 'lib/twitter_cldr/shared/property_set.rb', line 96

def script
  properties_hash['Script'] ||= ['Unknown']
end

#script_extensionsObject



92
93
94
# File 'lib/twitter_cldr/shared/property_set.rb', line 92

def script_extensions
  properties_hash['Script_Extensions'] ||= ['<script>']
end

#sentence_breakObject



100
101
102
# File 'lib/twitter_cldr/shared/property_set.rb', line 100

def sentence_break
  properties_hash['Sentence_Break'] ||= ['Other']
end

#word_breakObject



104
105
106
# File 'lib/twitter_cldr/shared/property_set.rb', line 104

def word_break
  properties_hash['Word_Break'] ||= ['Other']
end