turkish_support 0.0.4 → 0.1.0

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: aebbf4b1c2c8f0283519893af65a7af8ddff76f4
4
- data.tar.gz: 494229ce7f845ca31046b82159b039e33b43504c
3
+ metadata.gz: b2d1af86e3516703c1a1a9c9b63a2f5084420c0b
4
+ data.tar.gz: 29c3d95b0d17ed33157a1c3e6a82f24f03660fd2
5
5
  SHA512:
6
- metadata.gz: 65e2dc445b5eb618c8b4d647dcf1460dab949eb8b7510614d567133feb3d191c4f8aa29d99df068ebf00b4ceab30affd784464232e5ce530234b376444c7341c
7
- data.tar.gz: b2fed1c1d5d1f0e79828ba9a4dafa9308776bca9e2e4d4648fca73b359809e133a341f92d9c6dd0f6f6474ff5ea23f343fcfd1ec1e43200140414ca2299b919a
6
+ metadata.gz: bee27f7790ae647404b90d9c291e6b062d51799bd0f61ac6d2c7950547bf146e02a1dc04f586c0be093c5c61962ba7524375105c54a13d54471602ccad17b800
7
+ data.tar.gz: cd9a89e523e5def88c076dc5e686058b5c0bbd7101b9e01371283eb7c03d05853331a4b13bec50be7c12d0132c4f7eec8c4e1a3a9bd5a10c7dbb99a09c3e5160
data/README.md CHANGED
@@ -2,11 +2,27 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/turkish_support.svg)](http://badge.fury.io/rb/turkish_support)
4
4
 
5
-
6
- A gem for Turkish character support for `String#upcase`, `String#downcase`, `String#capitalize` methods and their destructive versions like `String#upcase!`. In other words; this gem is a lighter version of the UnicodeUtils gem.
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
- TurkishSupport uses refinements instead of monkey patching. So, you need to install at least v2.0.0 of Ruby.
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
- After installing the gem, you want to add a line before using Turkish supported version of the methods.
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 TurkishSupport
56
+ using TurkishSupport
31
57
  ```
32
58
 
33
- If you want to see a simple [gist](https://gist.github.com/sbagdat/9964521) that shows how should you use it.
59
+ ## Examples
34
60
 
35
- Now you can use your shiny new methods like below:
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
 
@@ -9,5 +9,9 @@ module TurkishSupport
9
9
  end
10
10
  end.join
11
11
  end
12
+
13
+ def swapcase!
14
+ replace(swapcase)
15
+ end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module TurkishSupport
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -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 iSMET".titleize
113
- expect(titleized).to eq("Merhaba Çamur İsmet")
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
- it "swaps characters correctly" do
119
- word = "mErHaba çamur ismetoğullarI".swapcase
120
- expect(word).to eq("MeRhABA ÇAMUR İSMETOĞULLARı")
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
-
@@ -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 characters support for upcase, downcase, etc.}
12
- spec.description = %q{A gem for Turkish character support for String#upcase, String#downcase, String#capitalize methods and their destructive versions like String#upcase!. In other words; this gem is a lighter version of the UnicodeUtils gem. }
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
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: 'A gem for Turkish character support for String#upcase, String#downcase,
56
- String#capitalize methods and their destructive versions like String#upcase!. In
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 characters support for upcase, downcase, etc.
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