turkish_support 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05f59d2e23f979fa67a13e40f3598ba4ae25b506
4
- data.tar.gz: 8ed7a3d8e73838c1ae6cace4f44be2713e11ceda
3
+ metadata.gz: b9977ac304561543e6bedb296775671794632132
4
+ data.tar.gz: ff1e14f5208eb1b53fce8305d12e371b4d9f4ed6
5
5
  SHA512:
6
- metadata.gz: 28cd46ba32f30d61acbca5fd689603ea41310bd15d1df62dfb9ad81b60bc8b6089186620a032ac710485a97d2d36f6972e307aaea423feaeb51edf3d6496e26c
7
- data.tar.gz: f755fb7dfec1191963a7ed822ccb95aff7c3cfc377a7644fd54b3074ee2fbc25a9383313652bd43853049b74e5e9231ab2d5693f0be546a68ffd588953868c0c
6
+ metadata.gz: a5d988d932c97b82ab3bc91388503fc659552453dbbdf1095419ba9ab001ae41a7d0d82e804df50af9a6fa009a5f82b0d9f2d17b66a22c879d3eea09048bf088
7
+ data.tar.gz: 5e310dba18dea8b458fe93170171f5167859ba94b221ed74b9320ea91de9c6985c02e204e9e6de532d60891115a9872cc91212b73658078cdeee61f826999f18
@@ -6,4 +6,8 @@ require "turkish_support/downcase"
6
6
  require "turkish_support/capitalize"
7
7
  require "turkish_support/titleize"
8
8
  require "turkish_support/casecmp"
9
+ require "turkish_support/swapcase"
10
+
11
+ module TurkishSupport
12
+ end
9
13
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module TurkishSupport
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  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.2
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