unicode_case_converter 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/unicode_case_converter/version.rb +1 -1
- data/lib/unicode_case_converter.rb +4 -0
- data/spec/unicode_case_converter_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 844460e46e8f0bc6de1aa637cb43b912e0cf6653
|
4
|
+
data.tar.gz: 7da928bdbcf271be0eb4503e6ce545c913980309
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95b9a7b948e36fb4854d38b9f138e6da51be0f0e63acddad5b368c4290cb22779bfe6263b16b38648cf75297fe3d2829c36cf684ccd2fe469880d0bf1f96ffbb
|
7
|
+
data.tar.gz: 1e794b7c010814358daffbcd6d0ed2b582455c79c65b2c101886d924145c3e9ded30453be89d5231d99eb22240e760d4cc8ba22239360606084d14973781601d
|
data/README.md
CHANGED
@@ -32,6 +32,10 @@ UnicodeCaseConverter::Converter.new(text).downcase
|
|
32
32
|
text = "αβγδεζηθικλμνξοπρστυφχψωάέήίόύώϊϋ"
|
33
33
|
UnicodeCaseConverter::Converter.new(text).upcase
|
34
34
|
# => "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΉΊΌΎΏΪΫ"
|
35
|
+
|
36
|
+
text = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΉΊΌΎΏΪΫ"
|
37
|
+
UnicodeCaseConverter::Converter.new(text).capitalize
|
38
|
+
# => "Αβγδεζηθικλμνξοπρστυφχψωάέήίόύώϊϋ"
|
35
39
|
```
|
36
40
|
|
37
41
|
## Contributing
|
@@ -139,5 +139,9 @@ module UnicodeCaseConverter
|
|
139
139
|
.gsub(/\u{2126}/, "\u{03C9}")
|
140
140
|
.gsub(/\u{212A}/, "\u{006B}")
|
141
141
|
end
|
142
|
+
|
143
|
+
def capitalize
|
144
|
+
UnicodeCaseConverter::Converter.new(UnicodeCaseConverter::Converter.new(text).downcase.slice(0,1)).upcase + UnicodeCaseConverter::Converter.new(text).downcase.slice(1..-1)
|
145
|
+
end
|
142
146
|
end
|
143
147
|
end
|
@@ -27,6 +27,20 @@ describe UnicodeCaseConverter do
|
|
27
27
|
expect(ucc.downcase).to eq("αβγδεζηθικλμνξοπρστυφχψωάέήίόύώϊϋ")
|
28
28
|
end
|
29
29
|
|
30
|
+
it "capitalizes a string (example)" do
|
31
|
+
text = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΆΈΉΊΌΎΏΪΫ".freeze
|
32
|
+
ucc = UnicodeCaseConverter::Converter.new(text)
|
33
|
+
unicode_result = Unicode.capitalize(text)
|
34
|
+
expect(ucc.capitalize).to eq(unicode_result)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "capitalizes a string 2" do
|
38
|
+
text = "hello world".freeze
|
39
|
+
ucc = UnicodeCaseConverter::Converter.new(text)
|
40
|
+
unicode_result = Unicode.capitalize(text)
|
41
|
+
expect(ucc.capitalize).to eq(unicode_result)
|
42
|
+
end
|
43
|
+
|
30
44
|
(0..3).each do |first_digit|
|
31
45
|
[*'0'..'9', *'A'..'F'].sample(16).sort.each do |second_digit|
|
32
46
|
[*'0'..'9', *'A'..'F'].sample(16).sort.each do |third_digit|
|