sort-by-alphabet 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/alphabets.rb +7 -7
- metadata +1 -1
data/lib/alphabets.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class Alphabet
|
2
2
|
|
3
3
|
def self.compare_letters_sensitive(x, y)
|
4
|
-
i1 = lower_case.index(x)
|
5
|
-
i2 = upper_case.index(x)
|
6
|
-
j1 = lower_case.index(y)
|
7
|
-
j2 = upper_case.index(y)
|
4
|
+
i1 = lower_case.mb_chars.index(x)
|
5
|
+
i2 = upper_case.mb_chars.index(x)
|
6
|
+
j1 = lower_case.mb_chars.index(y)
|
7
|
+
j2 = upper_case.mb_chars.index(y)
|
8
8
|
if !i1 && !i2 or !j1 && !j2
|
9
9
|
x <=> y
|
10
10
|
elsif i1 && j2
|
@@ -21,8 +21,8 @@ class Alphabet
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.compare_letters_insensitive(x, y)
|
24
|
-
i = lower_case.index(letter_to_lowercase(x))
|
25
|
-
j = lower_case.index(letter_to_lowercase(y))
|
24
|
+
i = lower_case.mb_chars.index(letter_to_lowercase(x))
|
25
|
+
j = lower_case.mb_chars.index(letter_to_lowercase(y))
|
26
26
|
if !i || !j
|
27
27
|
x <=> y
|
28
28
|
else
|
@@ -31,7 +31,7 @@ class Alphabet
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.letter_to_lowercase(a)
|
34
|
-
i = upper_case.index(a)
|
34
|
+
i = upper_case.mb_chars.index(a)
|
35
35
|
if i
|
36
36
|
lower_case[i]
|
37
37
|
else
|