Class: UnicodeCharacteristics
- Inherits:
-
Characteristics
- Object
- Characteristics
- UnicodeCharacteristics
- Defined in:
- lib/characteristics/unicode.rb
Constant Summary collapse
- BLANKS =
[ 0x0009, 0x0020, 0x00AD, 0x115F, 0x1160, 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x200B, 0x200C, 0x200D, 0x202F, 0x205F, 0x2060, 0x2061, 0x2062, 0x2063, 0x2064, 0x206A, 0x206B, 0x206C, 0x206D, 0x206E, 0x206F, 0x3000, 0x3164, 0x2800, 0xFEFF, 0x1BCA0, 0x1BCA1, 0x1BCA2, 0x1BCA3, 0x1D159, 0x1D173, 0x1D174, 0x1D175, 0x1D176, 0x1D177, 0x1D178, 0x1D179, 0x1D17A, ].freeze
- SEPARATORS =
[ 0x000A, 0x000B, 0x000C, 0x000D, 0x2028, 0x2029, ].freeze
Constants inherited from Characteristics
Instance Attribute Summary
Attributes inherited from Characteristics
Instance Method Summary collapse
- #assigned? ⇒ Boolean
- #blank? ⇒ Boolean
- #c0? ⇒ Boolean
- #c1? ⇒ Boolean
- #control? ⇒ Boolean
- #delete? ⇒ Boolean
-
#initialize(char) ⇒ UnicodeCharacteristics
constructor
A new instance of UnicodeCharacteristics.
- #unicode? ⇒ Boolean
Methods inherited from Characteristics
create, create_for_type, type_from_encoding_name, #valid?
Constructor Details
#initialize(char) ⇒ UnicodeCharacteristics
Returns a new instance of UnicodeCharacteristics.
67 68 69 70 71 72 73 74 |
# File 'lib/characteristics/unicode.rb', line 67 def initialize(char) super if @is_valid @category = Unicode::Categories.category(char) @ord = char.ord end end |
Instance Method Details
#assigned? ⇒ Boolean
80 81 82 |
# File 'lib/characteristics/unicode.rb', line 80 def assigned? @is_valid && @category != "Cn" end |
#blank? ⇒ Boolean
100 101 102 |
# File 'lib/characteristics/unicode.rb', line 100 def blank? @is_valid && ( BLANKS.include?(@ord) || SEPARATORS.include?(@ord) ) end |
#c0? ⇒ Boolean
88 89 90 |
# File 'lib/characteristics/unicode.rb', line 88 def c0? @is_valid && @ord < 0x20 end |
#c1? ⇒ Boolean
96 97 98 |
# File 'lib/characteristics/unicode.rb', line 96 def c1? @is_valid && @ord >= 0x80 && @ord < 0xA0 end |
#control? ⇒ Boolean
84 85 86 |
# File 'lib/characteristics/unicode.rb', line 84 def control? @is_valid && @category == "Cc" end |
#delete? ⇒ Boolean
92 93 94 |
# File 'lib/characteristics/unicode.rb', line 92 def delete? @is_valid && @ord == 0x7F end |
#unicode? ⇒ Boolean
76 77 78 |
# File 'lib/characteristics/unicode.rb', line 76 def unicode? true end |