chars 0.2.0 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +1 -1
- data/.gemspec +0 -0
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +8 -0
- data/.yardopts +1 -1
- data/ChangeLog.md +30 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +79 -46
- data/Rakefile +7 -30
- data/benchmarks/compare.rb +16 -0
- data/benchmarks/strings_in.rb +23 -0
- data/chars.gemspec +58 -7
- data/gemspec.yml +10 -4
- data/lib/chars/char_set.rb +193 -94
- data/lib/chars/chars.rb +78 -38
- data/lib/chars/extensions/integer.rb +51 -34
- data/lib/chars/extensions/string.rb +34 -17
- data/lib/chars/version.rb +2 -2
- data/spec/char_set_spec.rb +236 -133
- data/spec/chars_spec.rb +14 -73
- data/spec/{integer_spec.rb → extensions/integer_spec.rb} +19 -20
- data/spec/{string_spec.rb → extensions/string_spec.rb} +20 -19
- data/spec/spec_helper.rb +0 -1
- metadata +56 -98
data/lib/chars/chars.rb
CHANGED
@@ -1,60 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'chars/char_set'
|
2
4
|
|
3
5
|
module Chars
|
4
6
|
# The numeric decimal character set
|
5
|
-
NUMERIC = CharSet
|
7
|
+
NUMERIC = CharSet['0'..'9']
|
6
8
|
|
7
9
|
# The octal character set
|
8
|
-
OCTAL = CharSet
|
10
|
+
OCTAL = CharSet['0'..'7']
|
9
11
|
|
10
12
|
# The upper-case hexadecimal character set
|
11
|
-
UPPERCASE_HEXADECIMAL = NUMERIC
|
13
|
+
UPPERCASE_HEXADECIMAL = NUMERIC | CharSet['A'..'F']
|
12
14
|
|
13
15
|
# The lower-case hexadecimal character set
|
14
|
-
LOWERCASE_HEXADECIMAL = NUMERIC
|
16
|
+
LOWERCASE_HEXADECIMAL = NUMERIC | CharSet['a'..'f']
|
15
17
|
|
16
18
|
# The hexadecimal character set
|
17
|
-
HEXADECIMAL = UPPERCASE_HEXADECIMAL
|
19
|
+
HEXADECIMAL = UPPERCASE_HEXADECIMAL | LOWERCASE_HEXADECIMAL
|
18
20
|
|
19
21
|
# The upper-case alpha character set
|
20
|
-
UPPERCASE_ALPHA = CharSet
|
22
|
+
UPPERCASE_ALPHA = CharSet['A'..'Z']
|
21
23
|
|
22
24
|
# The lower-case alpha character set
|
23
|
-
LOWERCASE_ALPHA = CharSet
|
25
|
+
LOWERCASE_ALPHA = CharSet['a'..'z']
|
24
26
|
|
25
27
|
# The alpha character set
|
26
|
-
ALPHA = UPPERCASE_ALPHA
|
28
|
+
ALPHA = UPPERCASE_ALPHA | LOWERCASE_ALPHA
|
27
29
|
|
28
30
|
# The alpha-numeric character set
|
29
|
-
ALPHA_NUMERIC = ALPHA
|
31
|
+
ALPHA_NUMERIC = ALPHA | NUMERIC
|
30
32
|
|
31
33
|
# The punctuation character set
|
32
|
-
PUNCTUATION = CharSet
|
33
|
-
|
34
|
+
PUNCTUATION = CharSet[' ', '\'', '"', '`', ',', ';', ':', '~', '-',
|
35
|
+
'(', ')', '[', ']', '{', '}', '.', '?', '!']
|
34
36
|
|
35
37
|
# The symbolic character set
|
36
|
-
SYMBOLS = PUNCTUATION
|
37
|
-
'
|
38
|
+
SYMBOLS = PUNCTUATION | CharSet[
|
39
|
+
'@', '#', '$', '%', '^', '&', '*', '_', '+',
|
40
|
+
'=', '|', '\\', '<', '>', '/'
|
41
|
+
]
|
38
42
|
|
39
43
|
# The space character set
|
40
|
-
SPACE = CharSet
|
44
|
+
SPACE = CharSet[' ', "\f", "\n", "\r", "\t", "\v"]
|
41
45
|
|
42
46
|
# The set of printable characters (not including spaces)
|
43
|
-
VISIBLE = ALPHA_NUMERIC
|
44
|
-
|
45
|
-
|
47
|
+
VISIBLE = ALPHA_NUMERIC | CharSet[
|
48
|
+
'\'', '"', '`', ',', ';', ':', '~', '-',
|
49
|
+
'(', ')', '[', ']', '{', '}', '.', '?', '!', '@', '#', '$',
|
50
|
+
'%', '^', '&', '*', '_', '+', '=', '|', '\\', '<', '>', '/'
|
51
|
+
]
|
46
52
|
|
47
53
|
# The set of printable characters (including spaces)
|
48
|
-
PRINTABLE = ALPHA_NUMERIC
|
54
|
+
PRINTABLE = ALPHA_NUMERIC | PUNCTUATION | SYMBOLS | SPACE
|
49
55
|
|
50
56
|
# The control-char character set
|
51
|
-
CONTROL = CharSet
|
57
|
+
CONTROL = CharSet[0..0x1f, 0x7f]
|
52
58
|
|
53
59
|
# The signed ASCII character set
|
54
|
-
SIGNED_ASCII = CharSet
|
60
|
+
SIGNED_ASCII = CharSet[0..0x7f]
|
55
61
|
|
56
62
|
# The full 8-bit character set
|
57
|
-
ASCII = CharSet
|
63
|
+
ASCII = CharSet[0..0xff]
|
58
64
|
|
59
65
|
#
|
60
66
|
# The decimal-digit character set.
|
@@ -62,7 +68,9 @@ module Chars
|
|
62
68
|
# @return [CharSet]
|
63
69
|
# The decimal-digit character set.
|
64
70
|
#
|
65
|
-
|
71
|
+
# @see NUMERIC
|
72
|
+
#
|
73
|
+
def self.numeric
|
66
74
|
NUMERIC
|
67
75
|
end
|
68
76
|
|
@@ -72,7 +80,9 @@ module Chars
|
|
72
80
|
# @return [CharSet]
|
73
81
|
# The octal-digit character set.
|
74
82
|
#
|
75
|
-
|
83
|
+
# @see OCTAL
|
84
|
+
#
|
85
|
+
def self.octal
|
76
86
|
OCTAL
|
77
87
|
end
|
78
88
|
|
@@ -82,7 +92,9 @@ module Chars
|
|
82
92
|
# @return [CharSet]
|
83
93
|
# The upper-case hexadecimal character set.
|
84
94
|
#
|
85
|
-
|
95
|
+
# @see UPPERCASE_HEXADECIMAL
|
96
|
+
#
|
97
|
+
def self.uppercase_hexadecimal
|
86
98
|
UPPERCASE_HEXADECIMAL
|
87
99
|
end
|
88
100
|
|
@@ -92,7 +104,9 @@ module Chars
|
|
92
104
|
# @return [CharSet]
|
93
105
|
# The lower-case hexadecimal character set.
|
94
106
|
#
|
95
|
-
|
107
|
+
# @see LOWERCASE_HEXADECIMAL
|
108
|
+
#
|
109
|
+
def self.lowercase_hexadecimal
|
96
110
|
LOWERCASE_HEXADECIMAL
|
97
111
|
end
|
98
112
|
|
@@ -102,7 +116,9 @@ module Chars
|
|
102
116
|
# @return [CharSet]
|
103
117
|
# The hexadecimal character set.
|
104
118
|
#
|
105
|
-
|
119
|
+
# @see HEXADECIMAL
|
120
|
+
#
|
121
|
+
def self.hexadecimal
|
106
122
|
HEXADECIMAL
|
107
123
|
end
|
108
124
|
|
@@ -112,7 +128,9 @@ module Chars
|
|
112
128
|
# @return [CharSet]
|
113
129
|
# The upper-case alphabetic character set.
|
114
130
|
#
|
115
|
-
|
131
|
+
# @see UPPERCASE_ALPHA
|
132
|
+
#
|
133
|
+
def self.uppercase_alpha
|
116
134
|
UPPERCASE_ALPHA
|
117
135
|
end
|
118
136
|
|
@@ -122,7 +140,9 @@ module Chars
|
|
122
140
|
# @return [CharSet]
|
123
141
|
# The lower-case alphabetic character set.
|
124
142
|
#
|
125
|
-
|
143
|
+
# @see LOWERCASE_ALPHA
|
144
|
+
#
|
145
|
+
def self.lowercase_alpha
|
126
146
|
LOWERCASE_ALPHA
|
127
147
|
end
|
128
148
|
|
@@ -132,7 +152,9 @@ module Chars
|
|
132
152
|
# @return [CharSet]
|
133
153
|
# The alphabetic character set.
|
134
154
|
#
|
135
|
-
|
155
|
+
# @see ALPHA
|
156
|
+
#
|
157
|
+
def self.alpha
|
136
158
|
ALPHA
|
137
159
|
end
|
138
160
|
|
@@ -142,7 +164,9 @@ module Chars
|
|
142
164
|
# @return [CharSet]
|
143
165
|
# The alpha-numeric character set.
|
144
166
|
#
|
145
|
-
|
167
|
+
# @see ALPHA_NUMERIC
|
168
|
+
#
|
169
|
+
def self.alpha_numeric
|
146
170
|
ALPHA_NUMERIC
|
147
171
|
end
|
148
172
|
|
@@ -152,7 +176,9 @@ module Chars
|
|
152
176
|
# @return [CharSet]
|
153
177
|
# The punctuation character set.
|
154
178
|
#
|
155
|
-
|
179
|
+
# @see PUNCTUATION
|
180
|
+
#
|
181
|
+
def self.punctuation
|
156
182
|
PUNCTUATION
|
157
183
|
end
|
158
184
|
|
@@ -162,7 +188,9 @@ module Chars
|
|
162
188
|
# @return [CharSet]
|
163
189
|
# The symbolic character set.
|
164
190
|
#
|
165
|
-
|
191
|
+
# @see SYMBOLS
|
192
|
+
#
|
193
|
+
def self.symbols
|
166
194
|
SYMBOLS
|
167
195
|
end
|
168
196
|
|
@@ -172,7 +200,9 @@ module Chars
|
|
172
200
|
# @return [CharSet]
|
173
201
|
# The white-space character set.
|
174
202
|
#
|
175
|
-
|
203
|
+
# @see SPACE
|
204
|
+
#
|
205
|
+
def self.space
|
176
206
|
SPACE
|
177
207
|
end
|
178
208
|
|
@@ -182,7 +212,9 @@ module Chars
|
|
182
212
|
# @return [CharSet]
|
183
213
|
# The visible character set.
|
184
214
|
#
|
185
|
-
|
215
|
+
# @see VISIBLE
|
216
|
+
#
|
217
|
+
def self.visible
|
186
218
|
VISIBLE
|
187
219
|
end
|
188
220
|
|
@@ -192,7 +224,9 @@ module Chars
|
|
192
224
|
# @return [CharSet]
|
193
225
|
# The printable character set.
|
194
226
|
#
|
195
|
-
|
227
|
+
# @see PRINTABLE
|
228
|
+
#
|
229
|
+
def self.printable
|
196
230
|
PRINTABLE
|
197
231
|
end
|
198
232
|
|
@@ -202,7 +236,9 @@ module Chars
|
|
202
236
|
# @return [CharSet]
|
203
237
|
# The control-character character set.
|
204
238
|
#
|
205
|
-
|
239
|
+
# @see CONTROL
|
240
|
+
#
|
241
|
+
def self.control
|
206
242
|
CONTROL
|
207
243
|
end
|
208
244
|
|
@@ -212,7 +248,9 @@ module Chars
|
|
212
248
|
# @return [CharSet]
|
213
249
|
# The signed ASCII character set.
|
214
250
|
#
|
215
|
-
|
251
|
+
# @see SIGNED_ASCII
|
252
|
+
#
|
253
|
+
def self.signed_ascii
|
216
254
|
SIGNED_ASCII
|
217
255
|
end
|
218
256
|
|
@@ -222,7 +260,9 @@ module Chars
|
|
222
260
|
# @return [CharSet]
|
223
261
|
# The ASCII character set.
|
224
262
|
#
|
225
|
-
|
263
|
+
# @see ASCII
|
264
|
+
#
|
265
|
+
def self.ascii
|
226
266
|
ASCII
|
227
267
|
end
|
228
268
|
end
|
@@ -8,10 +8,11 @@ class Integer
|
|
8
8
|
# @return [Boolean]
|
9
9
|
# Specifies whether the byte belongs to the decimal-digit character set.
|
10
10
|
#
|
11
|
-
# @see Chars
|
11
|
+
# @see Chars::NUMERIC
|
12
|
+
# @see Chars::CharSet#include_byte?
|
12
13
|
#
|
13
14
|
def numeric?
|
14
|
-
Chars::NUMERIC.
|
15
|
+
Chars::NUMERIC.include_byte?(self)
|
15
16
|
end
|
16
17
|
|
17
18
|
#
|
@@ -20,10 +21,11 @@ class Integer
|
|
20
21
|
# @return [Boolean]
|
21
22
|
# Specifies whether the byte belongs to the octal-digit character set.
|
22
23
|
#
|
23
|
-
# @see Chars
|
24
|
+
# @see Chars::OCTAL
|
25
|
+
# @see Chars::CharSet#include_byte?
|
24
26
|
#
|
25
27
|
def octal?
|
26
|
-
Chars::OCTAL.
|
28
|
+
Chars::OCTAL.include_byte?(self)
|
27
29
|
end
|
28
30
|
|
29
31
|
#
|
@@ -34,10 +36,11 @@ class Integer
|
|
34
36
|
# Specifies whether the byte belongs to the upper-case hexadecimal
|
35
37
|
# character set.
|
36
38
|
#
|
37
|
-
# @see Chars
|
39
|
+
# @see Chars::UPPERCASE_HEXADECIMAL
|
40
|
+
# @see Chars::CharSet#include_byte?
|
38
41
|
#
|
39
42
|
def uppercase_hex?
|
40
|
-
Chars::UPPERCASE_HEXADECIMAL.
|
43
|
+
Chars::UPPERCASE_HEXADECIMAL.include_byte?(self)
|
41
44
|
end
|
42
45
|
|
43
46
|
#
|
@@ -48,10 +51,11 @@ class Integer
|
|
48
51
|
# Specifies whether the byte belongs to the lower-case hexadecimal
|
49
52
|
# character set.
|
50
53
|
#
|
51
|
-
# @see Chars
|
54
|
+
# @see Chars::LOWERCASE_HEXADECIMAL
|
55
|
+
# @see Chars::CharSet#include_byte?
|
52
56
|
#
|
53
57
|
def lowercase_hex?
|
54
|
-
Chars::LOWERCASE_HEXADECIMAL.
|
58
|
+
Chars::LOWERCASE_HEXADECIMAL.include_byte?(self)
|
55
59
|
end
|
56
60
|
|
57
61
|
#
|
@@ -60,10 +64,11 @@ class Integer
|
|
60
64
|
# @return [Boolean]
|
61
65
|
# Specifies whether the byte belongs to the hexadecimal character set.
|
62
66
|
#
|
63
|
-
# @see Chars
|
67
|
+
# @see Chars::HEXADECIMAL
|
68
|
+
# @see Chars::CharSet#include_byte?
|
64
69
|
#
|
65
70
|
def hex?
|
66
|
-
Chars::HEXADECIMAL.
|
71
|
+
Chars::HEXADECIMAL.include_byte?(self)
|
67
72
|
end
|
68
73
|
|
69
74
|
#
|
@@ -74,10 +79,11 @@ class Integer
|
|
74
79
|
# Specifies whether the byte belongs to the upper-case alphabetic
|
75
80
|
# character set.
|
76
81
|
#
|
77
|
-
# @see Chars
|
82
|
+
# @see Chars::UPPERCASE_ALPHA
|
83
|
+
# @see Chars::CharSet#include_byte?
|
78
84
|
#
|
79
85
|
def uppercase_alpha?
|
80
|
-
Chars::UPPERCASE_ALPHA.
|
86
|
+
Chars::UPPERCASE_ALPHA.include_byte?(self)
|
81
87
|
end
|
82
88
|
|
83
89
|
#
|
@@ -88,10 +94,11 @@ class Integer
|
|
88
94
|
# Specifies whether the byte belongs to the lower-case alphabetic
|
89
95
|
# character set.
|
90
96
|
#
|
91
|
-
# @see Chars
|
97
|
+
# @see Chars::LOWERCASE_ALPHA
|
98
|
+
# @see Chars::CharSet#include_byte?
|
92
99
|
#
|
93
100
|
def lowercase_alpha?
|
94
|
-
Chars::LOWERCASE_ALPHA.
|
101
|
+
Chars::LOWERCASE_ALPHA.include_byte?(self)
|
95
102
|
end
|
96
103
|
|
97
104
|
#
|
@@ -100,10 +107,11 @@ class Integer
|
|
100
107
|
# @return [Boolean]
|
101
108
|
# Specifies whether the byte belongs to the alphabetic character set.
|
102
109
|
#
|
103
|
-
# @see Chars
|
110
|
+
# @see Chars::ALPHA
|
111
|
+
# @see Chars::CharSet#include_byte?
|
104
112
|
#
|
105
113
|
def alpha?
|
106
|
-
Chars::ALPHA.
|
114
|
+
Chars::ALPHA.include_byte?(self)
|
107
115
|
end
|
108
116
|
|
109
117
|
#
|
@@ -112,10 +120,11 @@ class Integer
|
|
112
120
|
# @return [Boolean]
|
113
121
|
# Specifies whether the byte belongs to the alpha-numeric character set.
|
114
122
|
#
|
115
|
-
# @see Chars
|
123
|
+
# @see Chars::ALPHA_NUMERIC
|
124
|
+
# @see Chars::CharSet#include_byte?
|
116
125
|
#
|
117
126
|
def alpha_numeric?
|
118
|
-
Chars::ALPHA_NUMERIC.
|
127
|
+
Chars::ALPHA_NUMERIC.include_byte?(self)
|
119
128
|
end
|
120
129
|
|
121
130
|
#
|
@@ -124,10 +133,11 @@ class Integer
|
|
124
133
|
# @return [Boolean]
|
125
134
|
# Specifies whether the byte belongs to the punctuation character set.
|
126
135
|
#
|
127
|
-
# @see Chars
|
136
|
+
# @see Chars::PUNCTUATION
|
137
|
+
# @see Chars::CharSet#include_byte?
|
128
138
|
#
|
129
139
|
def punctuation?
|
130
|
-
Chars::PUNCTUATION.
|
140
|
+
Chars::PUNCTUATION.include_byte?(self)
|
131
141
|
end
|
132
142
|
|
133
143
|
#
|
@@ -136,10 +146,11 @@ class Integer
|
|
136
146
|
# @return [Boolean]
|
137
147
|
# Specifies whether the byte belongs to the symbolic character set.
|
138
148
|
#
|
139
|
-
# @see Chars
|
149
|
+
# @see Chars::SYMBOLS
|
150
|
+
# @see Chars::CharSet#include_byte?
|
140
151
|
#
|
141
152
|
def symbolic?
|
142
|
-
Chars::SYMBOLS.
|
153
|
+
Chars::SYMBOLS.include_byte?(self)
|
143
154
|
end
|
144
155
|
|
145
156
|
#
|
@@ -148,10 +159,11 @@ class Integer
|
|
148
159
|
# @return [Boolean]
|
149
160
|
# Specifies whether the byte belongs to the white-space character set.
|
150
161
|
#
|
151
|
-
# @see Chars
|
162
|
+
# @see Chars::SPACE
|
163
|
+
# @see Chars::CharSet#include_byte?
|
152
164
|
#
|
153
165
|
def space?
|
154
|
-
Chars::SPACE.
|
166
|
+
Chars::SPACE.include_byte?(self)
|
155
167
|
end
|
156
168
|
|
157
169
|
#
|
@@ -160,10 +172,11 @@ class Integer
|
|
160
172
|
# @return [Boolean]
|
161
173
|
# Specifies whether the byte belongs to the visible character set.
|
162
174
|
#
|
163
|
-
# @see Chars
|
175
|
+
# @see Chars::VISIBLE
|
176
|
+
# @see Chars::CharSet#include_byte?
|
164
177
|
#
|
165
178
|
def visible?
|
166
|
-
Chars::VISIBLE.
|
179
|
+
Chars::VISIBLE.include_byte?(self)
|
167
180
|
end
|
168
181
|
|
169
182
|
#
|
@@ -172,10 +185,11 @@ class Integer
|
|
172
185
|
# @return [Boolean]
|
173
186
|
# Specifies whether the byte belongs to the printable character set.
|
174
187
|
#
|
175
|
-
# @see Chars
|
188
|
+
# @see Chars::PRINTABLE
|
189
|
+
# @see Chars::CharSet#include_byte?
|
176
190
|
#
|
177
191
|
def printable?
|
178
|
-
Chars::PRINTABLE.
|
192
|
+
Chars::PRINTABLE.include_byte?(self)
|
179
193
|
end
|
180
194
|
|
181
195
|
#
|
@@ -185,10 +199,11 @@ class Integer
|
|
185
199
|
# Specifies whether the byte belongs to the control-character character
|
186
200
|
# set.
|
187
201
|
#
|
188
|
-
# @see Chars
|
202
|
+
# @see Chars::CONTROL
|
203
|
+
# @see Chars::CharSet#include_byte?
|
189
204
|
#
|
190
205
|
def control?
|
191
|
-
Chars::CONTROL.
|
206
|
+
Chars::CONTROL.include_byte?(self)
|
192
207
|
end
|
193
208
|
|
194
209
|
#
|
@@ -197,10 +212,11 @@ class Integer
|
|
197
212
|
# @return [Boolean]
|
198
213
|
# Specifies whether the byte belongs to the signed-ASCII character set.
|
199
214
|
#
|
200
|
-
# @see Chars
|
215
|
+
# @see Chars::SIGNED_ASCII
|
216
|
+
# @see Chars::CharSet#include_byte?
|
201
217
|
#
|
202
218
|
def signed_ascii?
|
203
|
-
Chars::SIGNED_ASCII.
|
219
|
+
Chars::SIGNED_ASCII.include_byte?(self)
|
204
220
|
end
|
205
221
|
|
206
222
|
#
|
@@ -209,10 +225,11 @@ class Integer
|
|
209
225
|
# @return [Boolean]
|
210
226
|
# Specifies whether the byte belongs to the ASCII character set.
|
211
227
|
#
|
212
|
-
# @see Chars
|
228
|
+
# @see Chars::ASCII
|
229
|
+
# @see Chars::CharSet#include_byte?
|
213
230
|
#
|
214
231
|
def ascii?
|
215
|
-
Chars::ASCII.
|
232
|
+
Chars::ASCII.include_byte?(self)
|
216
233
|
end
|
217
234
|
|
218
235
|
end
|
@@ -9,7 +9,8 @@ class String
|
|
9
9
|
# Specifies whether the String belongs to the decimal-digit character
|
10
10
|
# set.
|
11
11
|
#
|
12
|
-
# @see Chars
|
12
|
+
# @see Chars::NUMERIC
|
13
|
+
# @see Chars::CharSet#===
|
13
14
|
#
|
14
15
|
def numeric?
|
15
16
|
Chars::NUMERIC === self
|
@@ -22,7 +23,8 @@ class String
|
|
22
23
|
# Specifies whether the String belongs to the octal-digit character
|
23
24
|
# set.
|
24
25
|
#
|
25
|
-
# @see Chars
|
26
|
+
# @see Chars::OCTAL
|
27
|
+
# @see Chars::CharSet#===
|
26
28
|
#
|
27
29
|
def octal?
|
28
30
|
Chars::OCTAL === self
|
@@ -36,7 +38,8 @@ class String
|
|
36
38
|
# Specifies whether the String belongs to the upper-case hexadecimal
|
37
39
|
# character set.
|
38
40
|
#
|
39
|
-
# @see Chars
|
41
|
+
# @see Chars::UPPERCASE_HEXADECIMAL
|
42
|
+
# @see Chars::CharSet#===
|
40
43
|
#
|
41
44
|
def uppercase_hex?
|
42
45
|
Chars::UPPERCASE_HEXADECIMAL === self
|
@@ -50,7 +53,8 @@ class String
|
|
50
53
|
# Specifies whether the String belongs to the lower-case hexadecimal
|
51
54
|
# character set.
|
52
55
|
#
|
53
|
-
# @see Chars
|
56
|
+
# @see Chars::LOWERCASE_HEXADECIMAL
|
57
|
+
# @see Chars::CharSet#===
|
54
58
|
#
|
55
59
|
def lowercase_hex?
|
56
60
|
Chars::LOWERCASE_HEXADECIMAL === self
|
@@ -62,7 +66,8 @@ class String
|
|
62
66
|
# @return [Boolean]
|
63
67
|
# Specifies whether the String belongs to the hexadecimal character set.
|
64
68
|
#
|
65
|
-
# @see Chars
|
69
|
+
# @see Chars::HEXADECIMAL
|
70
|
+
# @see Chars::CharSet#===
|
66
71
|
#
|
67
72
|
def hex?
|
68
73
|
Chars::HEXADECIMAL === self
|
@@ -76,7 +81,8 @@ class String
|
|
76
81
|
# Specifies whether the String belongs to the upper-case alphabetic
|
77
82
|
# character set.
|
78
83
|
#
|
79
|
-
# @see Chars
|
84
|
+
# @see Chars::UPPERCASE_ALPHA
|
85
|
+
# @see Chars::CharSet#===
|
80
86
|
#
|
81
87
|
def uppercase_alpha?
|
82
88
|
Chars::UPPERCASE_ALPHA === self
|
@@ -90,7 +96,8 @@ class String
|
|
90
96
|
# Specifies whether the String belongs to the lower-case alphabetic
|
91
97
|
# character set.
|
92
98
|
#
|
93
|
-
# @see Chars
|
99
|
+
# @see Chars::LOWERCASE_ALPHA
|
100
|
+
# @see Chars::CharSet#===
|
94
101
|
#
|
95
102
|
def lowercase_alpha?
|
96
103
|
Chars::LOWERCASE_ALPHA === self
|
@@ -102,7 +109,8 @@ class String
|
|
102
109
|
# @return [Boolean]
|
103
110
|
# Specifies whether the String belongs to the alphabetic character set.
|
104
111
|
#
|
105
|
-
# @see Chars
|
112
|
+
# @see Chars::ALPHA
|
113
|
+
# @see Chars::CharSet#===
|
106
114
|
#
|
107
115
|
def alpha?
|
108
116
|
Chars::ALPHA === self
|
@@ -116,7 +124,8 @@ class String
|
|
116
124
|
# Specifies whether the String belongs to the alpha-numeric character
|
117
125
|
# set.
|
118
126
|
#
|
119
|
-
# @see Chars
|
127
|
+
# @see Chars::ALPHA_NUMERIC
|
128
|
+
# @see Chars::CharSet#===
|
120
129
|
#
|
121
130
|
def alpha_numeric?
|
122
131
|
Chars::ALPHA_NUMERIC === self
|
@@ -128,7 +137,8 @@ class String
|
|
128
137
|
# @return [Boolean]
|
129
138
|
# Specifies whether the String belongs to the punctuation character set.
|
130
139
|
#
|
131
|
-
# @see Chars
|
140
|
+
# @see Chars::PUNCTUATION
|
141
|
+
# @see Chars::CharSet#===
|
132
142
|
#
|
133
143
|
def punctuation?
|
134
144
|
Chars::PUNCTUATION === self
|
@@ -140,7 +150,8 @@ class String
|
|
140
150
|
# @return [Boolean]
|
141
151
|
# Specifies whether the String belongs to the symbolic character set.
|
142
152
|
#
|
143
|
-
# @see Chars
|
153
|
+
# @see Chars::SYMBOLS
|
154
|
+
# @see Chars::CharSet#===
|
144
155
|
#
|
145
156
|
def symbolic?
|
146
157
|
Chars::SYMBOLS === self
|
@@ -152,7 +163,8 @@ class String
|
|
152
163
|
# @return [Boolean]
|
153
164
|
# Specifies whether the String belongs to the white-space character set.
|
154
165
|
#
|
155
|
-
# @see Chars
|
166
|
+
# @see Chars::SPACE
|
167
|
+
# @see Chars::CharSet#===
|
156
168
|
#
|
157
169
|
def space?
|
158
170
|
Chars::SPACE === self
|
@@ -164,7 +176,8 @@ class String
|
|
164
176
|
# @return [Boolean]
|
165
177
|
# Specifies whether the String belongs to the visible character set.
|
166
178
|
#
|
167
|
-
# @see Chars
|
179
|
+
# @see Chars::VISIBLE
|
180
|
+
# @see Chars::CharSet#===
|
168
181
|
#
|
169
182
|
def visible?
|
170
183
|
Chars::VISIBLE === self
|
@@ -176,7 +189,8 @@ class String
|
|
176
189
|
# @return [Boolean]
|
177
190
|
# Specifies whether the String belongs to the printable character set.
|
178
191
|
#
|
179
|
-
# @see Chars
|
192
|
+
# @see Chars::PRINTABLE
|
193
|
+
# @see Chars::CharSet#===
|
180
194
|
#
|
181
195
|
def printable?
|
182
196
|
Chars::PRINTABLE === self
|
@@ -190,7 +204,8 @@ class String
|
|
190
204
|
# Specifies whether the String belongs to the control-character
|
191
205
|
# character set.
|
192
206
|
#
|
193
|
-
# @see Chars
|
207
|
+
# @see Chars::CONTROL
|
208
|
+
# @see Chars::CharSet#===
|
194
209
|
#
|
195
210
|
def control?
|
196
211
|
Chars::CONTROL === self
|
@@ -203,7 +218,8 @@ class String
|
|
203
218
|
# Specifies whether the String belongs to the signed-ASCII character
|
204
219
|
# set.
|
205
220
|
#
|
206
|
-
# @see Chars
|
221
|
+
# @see Chars::SIGNED_ASCII
|
222
|
+
# @see Chars::CharSet#===
|
207
223
|
#
|
208
224
|
def signed_ascii?
|
209
225
|
Chars::SIGNED_ASCII === self
|
@@ -215,7 +231,8 @@ class String
|
|
215
231
|
# @return [Boolean]
|
216
232
|
# Specifies whether the String belongs to the ASCII character set.
|
217
233
|
#
|
218
|
-
# @see Chars
|
234
|
+
# @see Chars::ASCII
|
235
|
+
# @see Chars::CharSet#===
|
219
236
|
#
|
220
237
|
def ascii?
|
221
238
|
Chars::ASCII === self
|
data/lib/chars/version.rb
CHANGED