Class: TwitterCldr::Parsers::UnicodeRegexParser::CharacterSet
- Inherits:
-
Component
- Object
- Component
- TwitterCldr::Parsers::UnicodeRegexParser::CharacterSet
- Includes:
- Shared
- Defined in:
- lib/twitter_cldr/parsers/unicode_regex/character_set.rb
Overview
Can exist inside and outside of character classes
Instance Attribute Summary collapse
-
#property_name ⇒ Object
readonly
Returns the value of attribute property_name.
-
#property_value ⇒ Object
readonly
Returns the value of attribute property_value.
Instance Method Summary collapse
-
#initialize(text) ⇒ CharacterSet
constructor
A new instance of CharacterSet.
- #to_regexp_str ⇒ Object
- #to_s ⇒ Object
- #to_set ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(text) ⇒ CharacterSet
Returns a new instance of CharacterSet.
17 18 19 20 21 22 23 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 17 def initialize(text) if (name_parts = text.split("=")).size == 2 @property_name, @property_value = name_parts else @property_value = text end end |
Instance Attribute Details
#property_name ⇒ Object (readonly)
Returns the value of attribute property_name.
15 16 17 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 15 def property_name @property_name end |
#property_value ⇒ Object (readonly)
Returns the value of attribute property_value.
15 16 17 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 15 def property_value @property_value end |
Instance Method Details
#to_regexp_str ⇒ Object
25 26 27 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 25 def to_regexp_str set_to_regex(to_set) end |
#to_s ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 35 def to_s if property_value "[:#{property_name}=#{property_value}:]" else "[:#{property_name}:]" end end |
#to_set ⇒ Object
29 30 31 32 33 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 29 def to_set codepoints.subtract( TwitterCldr::Shared::UnicodeRegex.invalid_regexp_chars ) end |
#type ⇒ Object
43 44 45 |
# File 'lib/twitter_cldr/parsers/unicode_regex/character_set.rb', line 43 def type :character_set end |