Module: Stringprep
- Extended by:
- Stringprep
- Included in:
- Stringprep
- Defined in:
- lib/stringprep.rb,
lib/stringprep/rfc3454.rb,
lib/stringprep/version.rb,
lib/stringprep/table/in.rb,
lib/stringprep/table/map.rb,
lib/stringprep/table/base.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.0.2'
Instance Method Summary collapse
-
#in_a1(code) ⇒ Object
Determine whether code is in tableA.1 (Unassigned code points in Unicode 3.2).
-
#in_b1(code) ⇒ Object
Determine whether code is in tableB.1 (Commonly mapped to nothing).
-
#in_c11(code) ⇒ Object
Determine whether code is in tableC.1.1 (ASCII space characters).
-
#in_c11_c12(code) ⇒ Object
Determine whether code is in tableC.1 (Space characters, union of C.1.1 and C.1.2).
-
#in_c12(code) ⇒ Object
Determine whether code is in tableC.1.2 (Non-ASCII space characters).
-
#in_c21(code) ⇒ Object
Determine whether code is in tableC.2.1 (ASCII control characters).
-
#in_c21_c22(code) ⇒ Object
Determine whether code is in tableC.2 (Control characters, union of C.2.1 and C.2.2).
-
#in_c22(code) ⇒ Object
Determine whether code is in tableC.2.2 (Non-ASCII control characters).
-
#in_c3(code) ⇒ Object
Determine whether code is in tableC.3 (Private use).
-
#in_c4(code) ⇒ Object
Determine whether code is in tableC.4 (Non-character code points).
-
#in_c5(code) ⇒ Object
Determine whether code is in tableC.5 (Surrogate codes).
-
#in_c6(code) ⇒ Object
Determine whether code is in tableC.6 (Inappropriate for plain text).
-
#in_c7(code) ⇒ Object
Determine whether code is in tableC.7 (Inappropriate for canonical representation).
-
#in_c8(code) ⇒ Object
Determine whether code is in tableC.8 (Change display properties or are deprecated).
-
#in_c9(code) ⇒ Object
Determine whether code is in tableC.9 (Tagging characters).
-
#in_d1(code) ⇒ Object
Determine whether code is in tableD.1 (Characters with bidirectional property “R” or “AL”).
-
#in_d2(code) ⇒ Object
Determine whether code is in tableD.2 (Characters with bidirectional property “L”).
-
#map_b2(code) ⇒ Object
Return the mapped value for code according to tableB.2 (Mapping for case-folding used with NFKC).
-
#map_b3(code) ⇒ Object
Return the mapped value for code according to tableB.3 (Mapping for case-folding used with no normalization).
Instance Method Details
#in_a1(code) ⇒ Object
Determine whether code is in tableA.1 (Unassigned code points in Unicode 3.2).
5 6 7 8 |
# File 'lib/stringprep.rb', line 5 def in_a1(code) @a1 ||= Table::In.create_read_only(Rfc3454.tables['a1']) @a1.include?(code) end |
#in_b1(code) ⇒ Object
Determine whether code is in tableB.1 (Commonly mapped to nothing).
11 12 13 14 |
# File 'lib/stringprep.rb', line 11 def in_b1(code) @b1 ||= Table::In.create_read_only(Rfc3454.tables['b1']) @b1.include?(code) end |
#in_c11(code) ⇒ Object
Determine whether code is in tableC.1.1 (ASCII space characters).
29 30 31 32 |
# File 'lib/stringprep.rb', line 29 def in_c11(code) @c11 ||= Table::In.create_read_only(Rfc3454.tables['c11']) @c11.include? code end |
#in_c11_c12(code) ⇒ Object
Determine whether code is in tableC.1 (Space characters, union of C.1.1 and C.1.2).
41 42 43 |
# File 'lib/stringprep.rb', line 41 def in_c11_c12(code) in_c11(code) || in_c12(code) end |
#in_c12(code) ⇒ Object
Determine whether code is in tableC.1.2 (Non-ASCII space characters).
35 36 37 38 |
# File 'lib/stringprep.rb', line 35 def in_c12(code) @c12 ||= Table::In.create_read_only(Rfc3454.tables['c12']) @c12.include? code end |
#in_c21(code) ⇒ Object
Determine whether code is in tableC.2.1 (ASCII control characters).
46 47 48 49 |
# File 'lib/stringprep.rb', line 46 def in_c21(code) @c21 ||= Table::In.create_read_only(Rfc3454.tables['c21']) @c21.include? code end |
#in_c21_c22(code) ⇒ Object
Determine whether code is in tableC.2 (Control characters, union of C.2.1 and C.2.2).
58 59 60 |
# File 'lib/stringprep.rb', line 58 def in_c21_c22(code) in_c21(code) || in_c22(code) end |
#in_c22(code) ⇒ Object
Determine whether code is in tableC.2.2 (Non-ASCII control characters).
52 53 54 55 |
# File 'lib/stringprep.rb', line 52 def in_c22(code) @c22 ||= Table::In.create_read_only(Rfc3454.tables['c22']) @c22.include? code end |
#in_c3(code) ⇒ Object
Determine whether code is in tableC.3 (Private use).
63 64 65 66 |
# File 'lib/stringprep.rb', line 63 def in_c3(code) @c3 ||= Table::In.create_read_only(Rfc3454.tables['c3']) @c3.include?(code) end |
#in_c4(code) ⇒ Object
Determine whether code is in tableC.4 (Non-character code points).
69 70 71 72 |
# File 'lib/stringprep.rb', line 69 def in_c4(code) @c4 ||= Table::In.create_read_only(Rfc3454.tables['c4']) @c4.include?(code) end |
#in_c5(code) ⇒ Object
Determine whether code is in tableC.5 (Surrogate codes).
75 76 77 78 |
# File 'lib/stringprep.rb', line 75 def in_c5(code) @c5 ||= Table::In.create_read_only(Rfc3454.tables['c5']) @c5.include?(code) end |
#in_c6(code) ⇒ Object
Determine whether code is in tableC.6 (Inappropriate for plain text).
81 82 83 84 |
# File 'lib/stringprep.rb', line 81 def in_c6(code) @c6 ||= Table::In.create_read_only(Rfc3454.tables['c6']) @c6.include?(code) end |
#in_c7(code) ⇒ Object
Determine whether code is in tableC.7 (Inappropriate for canonical representation).
87 88 89 90 |
# File 'lib/stringprep.rb', line 87 def in_c7(code) @c7 ||= Table::In.create_read_only(Rfc3454.tables['c7']) @c7.include?(code) end |
#in_c8(code) ⇒ Object
Determine whether code is in tableC.8 (Change display properties or are deprecated).
93 94 95 96 |
# File 'lib/stringprep.rb', line 93 def in_c8(code) @c8 ||= Table::In.create_read_only(Rfc3454.tables['c8']) @c8.include?(code) end |
#in_c9(code) ⇒ Object
Determine whether code is in tableC.9 (Tagging characters).
99 100 101 102 |
# File 'lib/stringprep.rb', line 99 def in_c9(code) @c9 ||= Table::In.create_read_only(Rfc3454.tables['c9']) @c9.include?(code) end |
#in_d1(code) ⇒ Object
Determine whether code is in tableD.1 (Characters with bidirectional property “R” or “AL”).
105 106 107 108 |
# File 'lib/stringprep.rb', line 105 def in_d1(code) @d1 ||= Table::In.create_read_only(Rfc3454.tables['d1']) @d1.include?(code) end |
#in_d2(code) ⇒ Object
Determine whether code is in tableD.2 (Characters with bidirectional property “L”).
111 112 113 114 |
# File 'lib/stringprep.rb', line 111 def in_d2(code) @d2 ||= Table::In.create_read_only(Rfc3454.tables['d2']) @d2.include?(code) end |
#map_b2(code) ⇒ Object
Return the mapped value for code according to tableB.2 (Mapping for case-folding used with NFKC).
17 18 19 20 |
# File 'lib/stringprep.rb', line 17 def map_b2(code) @b2 ||= Table::Map.create_read_only(Rfc3454.tables['b2']) @b2.map(code) end |
#map_b3(code) ⇒ Object
Return the mapped value for code according to tableB.3 (Mapping for case-folding used with no normalization).
23 24 25 26 |
# File 'lib/stringprep.rb', line 23 def map_b3(code) @b3 ||= Table::Map.create_read_only(Rfc3454.tables['b3']) @b3.map(code) end |