unicode_alphanumeric 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/unicode_alphanumeric.rb +5 -1
- metadata +1 -1
data/lib/unicode_alphanumeric.rb
CHANGED
@@ -30,7 +30,11 @@ module UnicodeAlphanumeric
|
|
30
30
|
def self.alphanumeric?(char, options)
|
31
31
|
# If there's any intersection between the string's categories and the alphanumeric
|
32
32
|
# categories, then the character is alphanumeric.
|
33
|
-
|
33
|
+
#
|
34
|
+
# If we're using the :include options, we also have to check against that.
|
35
|
+
!(alphanumeric_categories(options) & Unicode.categories(char)).empty? or
|
36
|
+
(options[:include].is_a?(Array) and options[:include].include?(char)) or
|
37
|
+
(options[:include].is_a?(Regexp) and options[:include] =~ char)
|
34
38
|
end
|
35
39
|
|
36
40
|
def self.alphanumeric_categories(options)
|