turkish_support 0.0.4 → 0.1.0
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/README.md +41 -8
- data/lib/turkish_support/swapcase.rb +4 -0
- data/lib/turkish_support/version.rb +1 -1
- data/spec/turkish_support_spec.rb +21 -11
- data/turkish_support.gemspec +2 -2
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d1af86e3516703c1a1a9c9b63a2f5084420c0b
|
4
|
+
data.tar.gz: 29c3d95b0d17ed33157a1c3e6a82f24f03660fd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bee27f7790ae647404b90d9c291e6b062d51799bd0f61ac6d2c7950547bf146e02a1dc04f586c0be093c5c61962ba7524375105c54a13d54471602ccad17b800
|
7
|
+
data.tar.gz: cd9a89e523e5def88c076dc5e686058b5c0bbd7101b9e01371283eb7c03d05853331a4b13bec50be7c12d0132c4f7eec8c4e1a3a9bd5a10c7dbb99a09c3e5160
|
data/README.md
CHANGED
@@ -2,11 +2,27 @@
|
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/turkish_support)
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
Turkish character support for some standard Ruby methods. This gem provide support for these methods:
|
6
|
+
* `String#upcase`
|
7
|
+
* `String#upcase!`
|
8
|
+
* `String#downcase`
|
9
|
+
* `String#downcase!`
|
10
|
+
* `String#capitalize`
|
11
|
+
* `String#capitalize!`
|
12
|
+
* `String#swapcase`
|
13
|
+
* `String#swapcase!`
|
14
|
+
* `String#casecmp`
|
15
|
+
|
16
|
+
Also gives you some new methods like:
|
17
|
+
* `String#titleize`
|
7
18
|
|
8
19
|
## Requirements
|
9
|
-
|
20
|
+
|
21
|
+
* Ruby >= 2.0.0
|
22
|
+
* Rails >= 4.0.0
|
23
|
+
|
24
|
+
__Notice:__ TurkishSupport uses refinements instead of monkey patching. Refinements come with Ruby 2.0.0 as a new feature
|
25
|
+
and also, it is an experimental feature for now. If you want to more information about refinements, you can see the doc at [http://www.ruby-doc.org/core-2.0.0/doc/syntax/refinements_rdoc.html](http://www.ruby-doc.org/core-2.0.0/doc/syntax/refinements_rdoc.html)
|
10
26
|
|
11
27
|
## Installation
|
12
28
|
|
@@ -22,17 +38,27 @@ Or install it yourself as:
|
|
22
38
|
|
23
39
|
$ gem install turkish_support
|
24
40
|
|
25
|
-
## Usage
|
41
|
+
## Usage Instructions
|
42
|
+
|
43
|
+
After the installation of the gem, you should follow these steps.
|
44
|
+
|
45
|
+
* You need require it.
|
46
|
+
|
47
|
+
__Note:__ If you are using a framework like Rails, you don't need to require, because it is already required by the framework.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require TurkishSupport
|
51
|
+
```
|
26
52
|
|
27
|
-
|
53
|
+
* Add `using TurkishSupport` line to the top of the scope, __not inside of any class or module__.
|
28
54
|
|
29
55
|
```ruby
|
30
|
-
using
|
56
|
+
using TurkishSupport
|
31
57
|
```
|
32
58
|
|
33
|
-
|
59
|
+
## Examples
|
34
60
|
|
35
|
-
|
61
|
+
Within the file which you added `using TurkishSupport` line to the top of the scope; you can use core methods like below:
|
36
62
|
|
37
63
|
```ruby
|
38
64
|
str = 'Bağcılar'
|
@@ -46,6 +72,13 @@ Now you can use your shiny new methods like below:
|
|
46
72
|
"merhaba".capitalize #=> "Merhaba"
|
47
73
|
```
|
48
74
|
|
75
|
+
__Note:__ If you also want to use original set of the core methods in the same scope, you can use `send` method like this:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
str = 'Bağcılar'
|
79
|
+
str.send(:upcase) #=> "BAğCıLAR"
|
80
|
+
```
|
81
|
+
|
49
82
|
|
50
83
|
## Contributing
|
51
84
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
using TurkishSupport
|
2
3
|
|
3
4
|
module TurkishSupport
|
4
|
-
|
5
5
|
describe VERSION do
|
6
6
|
it 'should have a version number' do
|
7
7
|
TurkishSupport::VERSION.should_not be_nil
|
@@ -9,8 +9,6 @@ module TurkishSupport
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe String do
|
12
|
-
using TurkishSupport
|
13
|
-
|
14
12
|
let(:downcased_turkish_alphabet) { "abcçdefgğhıijklmnoöprsştuüvyz" }
|
15
13
|
let(:upcased_turkish_alphabet) { "ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ" }
|
16
14
|
let(:downcased_english_alphabet) { [*'a'..'z'].join }
|
@@ -109,20 +107,32 @@ module TurkishSupport
|
|
109
107
|
end
|
110
108
|
|
111
109
|
it "downcases characters other than first characters of all words" do
|
112
|
-
titleized = "mERHABA çAMUR
|
113
|
-
expect(titleized).to eq("Merhaba Çamur
|
110
|
+
titleized = "mERHABA çAMUR iSMETOĞULLARI".titleize
|
111
|
+
expect(titleized).to eq("Merhaba Çamur İsmetoğulları")
|
114
112
|
end
|
115
113
|
end
|
116
114
|
|
117
115
|
describe "#swapcase" do
|
118
|
-
|
119
|
-
|
120
|
-
|
116
|
+
context "with non-destructive version" do
|
117
|
+
it "does not change the original value of the string" do
|
118
|
+
word = "mErHaba çamur ismetoğullarI"
|
119
|
+
expect{ word.swapcase }.to_not change{ word }
|
120
|
+
end
|
121
|
+
|
122
|
+
it "swaps characters correctly" do
|
123
|
+
word = "mErHaba çamur ismetoğullarI".swapcase
|
124
|
+
expect(word).to eq("MeRhABA ÇAMUR İSMETOĞULLARı")
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
context "with destructive version" do
|
129
|
+
it "changes the original value of the string with the swapcased version" do
|
130
|
+
word = "mErHaba çamur ismetoğullarI"
|
131
|
+
expect{ word.swapcase! }.to change{ word }
|
132
|
+
expect(word).to eq('MeRhABA ÇAMUR İSMETOĞULLARı')
|
133
|
+
end
|
121
134
|
end
|
122
135
|
end
|
123
136
|
|
124
137
|
end
|
125
138
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
data/turkish_support.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = TurkishSupport::VERSION
|
9
9
|
spec.authors = ["Sıtkı Bağdat"]
|
10
10
|
spec.email = ["sbagdat@gmail.com"]
|
11
|
-
spec.summary = %q{Turkish
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{Turkish character support for some standard Ruby methods.}
|
12
|
+
spec.description = %q{Turkish character support for some standard Ruby methods like #upcase, #downcase, etc. Also provide some new useful methods like #titleize.}
|
13
13
|
spec.homepage = "https://github.com/sbagdat/turkish_support"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
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.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sıtkı Bağdat
|
@@ -52,9 +52,8 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: '
|
56
|
-
|
57
|
-
other words; this gem is a lighter version of the UnicodeUtils gem. '
|
55
|
+
description: 'Turkish character support for some standard Ruby methods like #upcase,
|
56
|
+
#downcase, etc. Also provide some new useful methods like #titleize.'
|
58
57
|
email:
|
59
58
|
- sbagdat@gmail.com
|
60
59
|
executables: []
|
@@ -104,7 +103,7 @@ rubyforge_project:
|
|
104
103
|
rubygems_version: 2.2.2
|
105
104
|
signing_key:
|
106
105
|
specification_version: 4
|
107
|
-
summary: Turkish
|
106
|
+
summary: Turkish character support for some standard Ruby methods.
|
108
107
|
test_files:
|
109
108
|
- spec/spec_helper.rb
|
110
109
|
- spec/turkish_support_spec.rb
|