Class: TwitterCldr::Parsers::UnicodeRegexParser::CharacterSet

Inherits:
Component
  • Object
show all
Defined in:
lib/twitter_cldr/parsers/unicode_regex/character_set.rb

Overview

Can exist inside and outside of character classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ CharacterSet

Returns a new instance of CharacterSet.



15
16
17
18
19
20
21
22
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 15

def initialize(text)
  if (name_parts = text.split("=")).size == 2
    @property = name_parts[0].downcase
    @property_value = name_parts[1].to_sym
  else
    @property_value = text
  end
end

Instance Attribute Details

#propertyObject (readonly)

Returns the value of attribute property.



13
14
15
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 13

def property
  @property
end

#property_valueObject (readonly)

Returns the value of attribute property_value.



13
14
15
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 13

def property_value
  @property_value
end

Instance Method Details

#to_regexp_strObject



24
25
26
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 24

def to_regexp_str
  set_to_regex(to_set)
end

#to_setObject



28
29
30
31
32
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 28

def to_set
  codepoints.subtract(
    TwitterCldr::Shared::UnicodeRegex.invalid_regexp_chars
  )
end