turkish_support 0.0.2 → 0.0.3
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 +4 -4
- data/lib/turkish_support.rb +4 -0
- data/lib/turkish_support/swapcase.rb +25 -0
- data/lib/turkish_support/version.rb +1 -1
- data/spec/turkish_support_spec.rb +8 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9977ac304561543e6bedb296775671794632132
|
4
|
+
data.tar.gz: ff1e14f5208eb1b53fce8305d12e371b4d9f4ed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d988d932c97b82ab3bc91388503fc659552453dbbdf1095419ba9ab001ae41a7d0d82e804df50af9a6fa009a5f82b0d9f2d17b66a22c879d3eea09048bf088
|
7
|
+
data.tar.gz: 5e310dba18dea8b458fe93170171f5167859ba94b221ed74b9320ea91de9c6985c02e204e9e6de532d60891115a9872cc91212b73658078cdeee61f826999f18
|
data/lib/turkish_support.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module TurkishSupport
|
2
|
+
refine String do
|
3
|
+
def is_unsupported_downcase?
|
4
|
+
UNSUPPORTED_CHARS[:downcase].include? self
|
5
|
+
end
|
6
|
+
|
7
|
+
def is_unsupported_upcase?
|
8
|
+
UNSUPPORTED_CHARS[:upcase].include? self
|
9
|
+
end
|
10
|
+
|
11
|
+
def is_unsupported?
|
12
|
+
is_unsupported_upcase? or is_unsupported_downcase?
|
13
|
+
end
|
14
|
+
|
15
|
+
def swapcase
|
16
|
+
chars.map do |ch|
|
17
|
+
if ch.is_unsupported?
|
18
|
+
ch.is_unsupported_downcase? ? ch.upcase : ch.downcase
|
19
|
+
else
|
20
|
+
ch.send(:swapcase)
|
21
|
+
end
|
22
|
+
end.join
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -108,6 +108,14 @@ module TurkishSupport
|
|
108
108
|
expect(titleized).to eq("Merhaba Çamur İsmet")
|
109
109
|
end
|
110
110
|
end
|
111
|
+
|
112
|
+
describe "#swapcase" do
|
113
|
+
it "swaps characters correctly" do
|
114
|
+
word = "mErHaba çamur ismetoğullarI".swapcase
|
115
|
+
expect(word).to eq("MeRhABA ÇAMUR İSMETOĞULLARı")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
111
119
|
end
|
112
120
|
end
|
113
121
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sıtkı Bağdat
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/turkish_support/constants.rb
|
75
75
|
- lib/turkish_support/downcase.rb
|
76
76
|
- lib/turkish_support/helpers.rb
|
77
|
+
- lib/turkish_support/swapcase.rb
|
77
78
|
- lib/turkish_support/titleize.rb
|
78
79
|
- lib/turkish_support/upcase.rb
|
79
80
|
- lib/turkish_support/version.rb
|