unicode_titlecase 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/README.md +68 -15
- data/lib/unicode_titlecase/core_ext/string.rb +61 -22
- data/lib/unicode_titlecase/version.rb +1 -1
- data/spec/string_misc_methods_spec.rb +234 -0
- data/unicode_titlecase.gemspec +6 -4
- metadata +13 -8
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
# unicode_titlecase gem
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/unicode_titlecase.png)](http://badge.fury.io/rb/unicode_titlecase)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/cantab/unicode_titlecase.png)](https://codeclimate.com/github/cantab/unicode_titlecase)
|
4
|
+
[![Build Status](https://travis-ci.org/cantab/unicode_titlecase.png?branch=master)](https://travis-ci.org/cantab/unicode_titlecase)
|
2
5
|
|
3
|
-
|
6
|
+
Gem to enable easy title casing of strings containing Unicode text.
|
7
|
+
|
8
|
+
## Introduction
|
9
|
+
This gem patches the String class to provide a unicode_titlecase method, which returns a string that is 'title cased': the first letter in each significant word is in capitals with the rest in lowercase.
|
4
10
|
|
5
11
|
## Features
|
12
|
+
* handles text containing Unicode characters
|
13
|
+
* handles words that should always be left capitalised (e.g., 'HIV')
|
14
|
+
* handles words that should always be left in lower case (e.g., 'to')
|
6
15
|
|
7
|
-
* handles Unicode text
|
8
|
-
* specify words that should always be left capitalised
|
9
|
-
* specify words that should always be left in lower case
|
10
|
-
|
11
16
|
## Installation
|
12
17
|
|
13
18
|
Add this line to your application's Gemfile:
|
@@ -20,21 +25,20 @@ And then execute:
|
|
20
25
|
|
21
26
|
Or install it yourself as:
|
22
27
|
|
23
|
-
$ gem install unicode_titlecase
|
28
|
+
$ gem install unicode_titlecase
|
24
29
|
|
25
30
|
## Usage
|
26
31
|
|
27
|
-
This gem patches the String class to provide a unicode_titlecase method, which returns a string that is 'title cased': the first letter in each significant word is in capitals with the rest in lowercase.
|
28
32
|
|
29
33
|
To use, just call the unicode_titlecase method on any string you want to titlecase.
|
30
34
|
|
31
35
|
For example,
|
32
36
|
|
33
37
|
require 'unicode_titlecase'
|
34
|
-
|
38
|
+
|
35
39
|
s = "the rain in spain stays mainly in the plain"
|
36
40
|
puts s.unicode_titlecase
|
37
|
-
|
41
|
+
|
38
42
|
gives
|
39
43
|
|
40
44
|
"The Rain in Spain Stays Mainly in the Plain"
|
@@ -45,9 +49,15 @@ More examples are set out in the YAML files in the /spec/examples directory.
|
|
45
49
|
|
46
50
|
With the help of the unicode-utils gem, we can properly handle title casing of Unicode text.
|
47
51
|
|
48
|
-
For example, the string
|
52
|
+
For example, the string
|
53
|
+
|
54
|
+
W Hiszpanii mży, gdy dżdżyste przyjdą dni
|
49
55
|
|
50
|
-
|
56
|
+
is titlecased to
|
57
|
+
|
58
|
+
W Hiszpanii Mży, Gdy Dżdżyste Przyjdą Dni
|
59
|
+
|
60
|
+
More examples [here](https://github.com/cantab/unicode_titlecase/blob/master/spec/examples/unicode_examples.yaml).
|
51
61
|
|
52
62
|
## 'Big Words'
|
53
63
|
|
@@ -55,13 +65,33 @@ In some circumstances, you may have source text that contains words that should
|
|
55
65
|
|
56
66
|
The unicode_titlecase gem allows you to set up a list of 'big words' which it will keep upper-cased.
|
57
67
|
|
68
|
+
"DNA vs RNA - difference and comparison".unicode_titlecase
|
69
|
+
|
70
|
+
produces
|
71
|
+
|
72
|
+
"DNA vs RNA - Difference and Comparison"
|
73
|
+
|
74
|
+
More examples [here](https://github.com/cantab/unicode_titlecase/blob/master/spec/examples/bigword_examples.yaml).
|
75
|
+
|
58
76
|
## 'Small Words'
|
59
77
|
|
60
78
|
Similarly, you source text may contain words that should always be in lower case.
|
61
79
|
|
62
|
-
|
80
|
+
For example, in English, a number of short words such as 'is', 'of' and 'by' might be considered to look better in title cased text if they remain in lower case.
|
63
81
|
|
64
|
-
|
82
|
+
So
|
83
|
+
|
84
|
+
'a government by the people for the people'.unicode_titlecase
|
85
|
+
|
86
|
+
will give
|
87
|
+
|
88
|
+
'A Government by the People for the People'
|
89
|
+
|
90
|
+
More examples [here](https://github.com/cantab/unicode_titlecase/blob/master/spec/examples/standard_examples.yaml).
|
91
|
+
|
92
|
+
## Troubleshooting
|
93
|
+
|
94
|
+
- [irb does not display Unicode] (https://github.com/cantab/unicode_titlecase/wiki/Displaying-Unicode-Text-in-irb)
|
65
95
|
|
66
96
|
## Sources and Acknowledgements
|
67
97
|
|
@@ -80,10 +110,10 @@ Much of the source is based on Sam Souder's 'titlecase' gem at [samsouder/titlec
|
|
80
110
|
- implemented rules in Ruby
|
81
111
|
- [Github repo] (http://github.com/samsouder/titlecase)
|
82
112
|
- [Rubygems.org] (http://rubygems.org/gems/titlecase)
|
83
|
-
|
113
|
+
|
84
114
|
#### Others
|
85
115
|
- Jim Nanney ([Github](https://github.com/jimnanney)) contributed to some of the code (go remote pairing!)
|
86
|
-
|
116
|
+
|
87
117
|
## Further Features?
|
88
118
|
Here's a list of things we'd like to see in a future version of the unicode_titlecase gem. Please feel free to take any of these on (see [Contributing] (http://github.com/cantab/unicode_titlecase#contributing) below).
|
89
119
|
- handle strings with 'mixed case words' such as GmbH
|
@@ -101,3 +131,26 @@ Feel free to drop us a line to let us know you would like to work on something o
|
|
101
131
|
5. Create a new [Pull Request] (https://help.github.com/articles/using-pull-requests).
|
102
132
|
|
103
133
|
More details on how to contribute can be found at this great Thoughtbot blogpost [8 (new) steps for fixing other people's code] (http://robots.thoughtbot.com/8-new-steps-for-fixing-other-peoples-code).
|
134
|
+
|
135
|
+
## License
|
136
|
+
|
137
|
+
Copyright (c) 2013 Chong-Yee Khoo, released under the MIT License.
|
138
|
+
|
139
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
140
|
+
a copy of this software and associated documentation files (the
|
141
|
+
"Software"), to deal in the Software without restriction, including
|
142
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
143
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
144
|
+
permit persons to whom the Software is furnished to do so, subject to
|
145
|
+
the following conditions:
|
146
|
+
|
147
|
+
The above copyright notice and this permission notice shall be
|
148
|
+
included in all copies or substantial portions of the Software.
|
149
|
+
|
150
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
151
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
152
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
153
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
154
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
155
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
156
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -6,37 +6,33 @@ module UnicodeTitlecase
|
|
6
6
|
module CoreExt
|
7
7
|
module String
|
8
8
|
|
9
|
+
# List of exceptions: SMALL_WORDS are words that should always be in lowercase; BIG_WORDS are words that should always be in uppercase
|
10
|
+
SMALL_WORDS = %w(a an and as at but by be for if in is of on or the to v v. via vs vs.)
|
11
|
+
BIG_WORDS = %w(AB A.B. A/B AS A.S. A/S S.A. KG LLC LLP DNA RNA HBV HIV I II III IV V VI VII VIII IX X AC DC Q&A AT&T)
|
12
|
+
|
9
13
|
def unicode_titlecase
|
10
|
-
# List of exceptions: small_words are words that should always be in lowercase; big_words are words that should always be in uppercase
|
11
|
-
small_words = %w(a an and as at but by be for if in is of on or the to v v. via vs vs.)
|
12
|
-
big_words = %w(AB A.B. A/B AS A.S. A/S S.A. KG LLC LLP DNA RNA HBV HIV I II III IV V VI VII VIII IX X AC DC Q&A AT&T)
|
13
14
|
|
14
|
-
|
15
|
+
component_words = split(" ").map do |word|
|
15
16
|
# note: word could contain non-word characters!
|
16
17
|
# downcase all small_words, upcase all big words, smart capitalize the rest
|
17
18
|
|
18
|
-
word.
|
19
|
+
word.unicode_downcase! if word.all_caps? and not word.is_big_word?
|
19
20
|
|
20
|
-
if
|
21
|
-
word.
|
21
|
+
if word.strip_non_word_chars.unicode_downcase.is_small_word?
|
22
|
+
word.unicode_downcase!
|
22
23
|
else
|
23
|
-
if
|
24
|
-
word.
|
24
|
+
if word.strip_non_word_chars.unicode_upcase.is_big_word?
|
25
|
+
word.unicode_upcase!
|
25
26
|
else
|
26
27
|
word.smart_capitalize!
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Uncomment the next line if you want the last word to be always initial caps
|
36
|
-
x.last.to_s.smart_capitalize!
|
37
|
-
|
38
|
-
# small words after colons are capitalized
|
39
|
-
x.join(" ").gsub(/:\s?(\W*#{small_words.join("|")}\W*)\s/) { ": #{$1.smart_capitalize} " }
|
32
|
+
component_words = strip_spaces(component_words)
|
33
|
+
smart_capitalize_ends!(component_words)
|
34
|
+
result = component_words.join(" ")
|
35
|
+
capitalize_small_words_after_colons(result)
|
40
36
|
end
|
41
37
|
|
42
38
|
def unicode_titlecase!
|
@@ -46,10 +42,10 @@ module UnicodeTitlecase
|
|
46
42
|
def smart_capitalize
|
47
43
|
# ignore any leading crazy characters and capitalize the first real character
|
48
44
|
if self =~ /^['"\(\[']*(\S)/
|
49
|
-
|
50
|
-
|
45
|
+
start_of_word = index($1)
|
46
|
+
word = self[start_of_word, self.length]
|
51
47
|
# word with capitals and periods mid-word are left alone
|
52
|
-
self[
|
48
|
+
self[start_of_word, 1] = UnicodeUtils.upcase(self[start_of_word, 1]) unless self.has_caps? or word =~ /\.\w+/
|
53
49
|
end
|
54
50
|
self
|
55
51
|
end
|
@@ -59,13 +55,56 @@ module UnicodeTitlecase
|
|
59
55
|
end
|
60
56
|
|
61
57
|
def has_caps?
|
62
|
-
return !UnicodeUtils.downcase(self) == self
|
58
|
+
return !(UnicodeUtils.downcase(self) == self)
|
63
59
|
end
|
64
60
|
|
65
61
|
def all_caps?
|
66
62
|
return UnicodeUtils.upcase(self) == self
|
67
63
|
end
|
68
64
|
|
65
|
+
def is_big_word?
|
66
|
+
BIG_WORDS.include?(self)
|
67
|
+
end
|
68
|
+
|
69
|
+
def is_small_word?
|
70
|
+
SMALL_WORDS.include?(self)
|
71
|
+
end
|
72
|
+
|
73
|
+
def unicode_downcase
|
74
|
+
UnicodeUtils.downcase(self)
|
75
|
+
end
|
76
|
+
|
77
|
+
def unicode_downcase!
|
78
|
+
replace(unicode_downcase)
|
79
|
+
end
|
80
|
+
|
81
|
+
def unicode_upcase
|
82
|
+
UnicodeUtils.upcase(self)
|
83
|
+
end
|
84
|
+
|
85
|
+
def unicode_upcase!
|
86
|
+
replace(unicode_upcase)
|
87
|
+
end
|
88
|
+
|
89
|
+
def smart_capitalize_ends!(ary)
|
90
|
+
# capitalize first and last words
|
91
|
+
ary.first.to_s.smart_capitalize!
|
92
|
+
# Uncomment the next line if you want the last word to be always initial caps
|
93
|
+
ary.last.to_s.smart_capitalize!
|
94
|
+
end
|
95
|
+
|
96
|
+
def capitalize_small_words_after_colons(str)
|
97
|
+
# small words after colons are capitalized
|
98
|
+
str.gsub(/:\s?(\W*#{SMALL_WORDS.join("|")}\W*)\s/) { ": #{$1.smart_capitalize} " }
|
99
|
+
end
|
100
|
+
|
101
|
+
def strip_spaces(ary)
|
102
|
+
ary - [' ']
|
103
|
+
end
|
104
|
+
|
105
|
+
def strip_non_word_chars
|
106
|
+
self.gsub(/\W/, "")
|
107
|
+
end
|
69
108
|
end
|
70
109
|
end
|
71
110
|
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
#encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
|
7
|
+
describe "has_caps? method" do
|
8
|
+
|
9
|
+
context "word with capital letter" do
|
10
|
+
|
11
|
+
it "identifies it as having caps" do
|
12
|
+
string = 'fluVial'
|
13
|
+
expect(string.has_caps?).to be_true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "word without capital letter" do
|
18
|
+
|
19
|
+
it "identifies it has not having caps" do
|
20
|
+
string = 'fluvial'
|
21
|
+
expect(string.has_caps?).to be_false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "all_caps? method" do
|
27
|
+
|
28
|
+
context "word completely in uppercase" do
|
29
|
+
|
30
|
+
it "identifies it as having all caps" do
|
31
|
+
string = 'FLUVIAL'
|
32
|
+
expect(string.all_caps?).to be_true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context "word not completely in uppercase" do
|
37
|
+
|
38
|
+
it "identifies it has not having all caps" do
|
39
|
+
string = 'FLUvIAL'
|
40
|
+
expect(string.all_caps?).to be_false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "word in lowercase" do
|
45
|
+
|
46
|
+
it "identifies it has not having all caps" do
|
47
|
+
string = 'fluvial'
|
48
|
+
expect(string.all_caps?).to be_false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "is_big_word? method" do
|
54
|
+
|
55
|
+
context "word in big words list" do
|
56
|
+
|
57
|
+
it "identifies it as being a big word" do
|
58
|
+
string = 'HIV'
|
59
|
+
expect(string.is_big_word?).to be_true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "word not in big words list" do
|
64
|
+
|
65
|
+
it "identifies it as not being a big word" do
|
66
|
+
string = 'SIV'
|
67
|
+
expect(string.is_big_word?).to be_false
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "is_small_word? method" do
|
73
|
+
|
74
|
+
context "word in small words list" do
|
75
|
+
|
76
|
+
it "identifies it as being a small word" do
|
77
|
+
string = 'is'
|
78
|
+
expect(string.is_small_word?).to be_true
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "word not in small words list" do
|
83
|
+
|
84
|
+
it "identifies it as not being a small word" do
|
85
|
+
string = 'tis'
|
86
|
+
expect(string.is_small_word?).to be_false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe "unicode_downcase method" do
|
92
|
+
|
93
|
+
it "downcases the word" do
|
94
|
+
string = 'Dżdżyste'
|
95
|
+
expect(string.unicode_downcase).to eq('dżdżyste')
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "unicode_downcase! method" do
|
100
|
+
|
101
|
+
it "downcases the word in place" do
|
102
|
+
string = 'Dżdżyste'
|
103
|
+
string.unicode_downcase!
|
104
|
+
expect(string).to eq('dżdżyste')
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe "unicode_upcase method" do
|
109
|
+
|
110
|
+
it "upcases the word" do
|
111
|
+
string = 'dżdżyste'
|
112
|
+
expect(string.unicode_upcase).to eq('DŻDŻYSTE')
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "unicode_upcase! method" do
|
117
|
+
|
118
|
+
it "upcases the word in place" do
|
119
|
+
string = 'dżdżyste'
|
120
|
+
string.unicode_upcase!
|
121
|
+
expect(string).to eq('DŻDŻYSTE')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe "smart_capitalize method" do
|
126
|
+
|
127
|
+
context "word with leading single quote mark" do
|
128
|
+
|
129
|
+
it "capitalizes word properly" do
|
130
|
+
expect("'fluvial".smart_capitalize).to eq("'Fluvial")
|
131
|
+
end
|
132
|
+
|
133
|
+
context "and internal capital letter" do
|
134
|
+
it "is left alone" do
|
135
|
+
expect("'flUvial".smart_capitalize).to eq("'flUvial")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "and internal period" do
|
140
|
+
it "is left alone" do
|
141
|
+
expect("'fl.vial".smart_capitalize).to eq("'fl.vial")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context "word with leading double quote mark" do
|
147
|
+
|
148
|
+
it "capitalizes word properly" do
|
149
|
+
expect('"fluvial'.smart_capitalize).to eq('"Fluvial')
|
150
|
+
end
|
151
|
+
|
152
|
+
context "and internal capital letter" do
|
153
|
+
it "is left alone" do
|
154
|
+
expect('"flUvial'.smart_capitalize).to eq('"flUvial')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context "and internal period" do
|
159
|
+
it "is left alone" do
|
160
|
+
expect('"fl.vial'.smart_capitalize).to eq('"fl.vial')
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context "word with leading open bracket" do
|
166
|
+
it "capitalizes word properly" do
|
167
|
+
expect('(fluvial'.smart_capitalize).to eq('(Fluvial')
|
168
|
+
end
|
169
|
+
|
170
|
+
context "and internal capital letter" do
|
171
|
+
it "is left alone" do
|
172
|
+
expect('(flUvial'.smart_capitalize).to eq('(flUvial')
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
context "and internal period" do
|
177
|
+
it "is left alone" do
|
178
|
+
expect('(fl.vial'.smart_capitalize).to eq('(fl.vial')
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context "word with leading open square bracket" do
|
184
|
+
it "capitalizes word properly" do
|
185
|
+
expect('[fluvial'.smart_capitalize).to eq('[Fluvial')
|
186
|
+
end
|
187
|
+
|
188
|
+
context "and internal capital letter" do
|
189
|
+
it "is left alone" do
|
190
|
+
expect('[flUvial'.smart_capitalize).to eq('[flUvial')
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context "and internal period" do
|
195
|
+
it "is left alone" do
|
196
|
+
expect('[fl.vial'.smart_capitalize).to eq('[fl.vial')
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
describe "smart_capitalize_ends! method" do
|
202
|
+
|
203
|
+
it "capitalizes first and last members of an array of words" do
|
204
|
+
array = ['fee', 'fi', 'fo', 'fum']
|
205
|
+
String.new.smart_capitalize_ends!(array)
|
206
|
+
expect(array).to eq(['Fee', 'fi', 'fo', 'Fum'])
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
describe "capitalize_small_words_after_colons method" do
|
211
|
+
|
212
|
+
it "capitalizes small words after colons" do
|
213
|
+
string = 'end: a begining'
|
214
|
+
expect(String.new.capitalize_small_words_after_colons(string)).to eq('end: A begining')
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
describe "strip_spaces method" do
|
219
|
+
|
220
|
+
it "strips members of array which are spaces" do
|
221
|
+
array = ['the', ' ', 'rain', ' ', 'in', ' ', 'spain', ' ']
|
222
|
+
expect(String.new.strip_spaces(array)).to eq(['the', 'rain', 'in', 'spain'])
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
describe "strip_non_word_chars method" do
|
227
|
+
|
228
|
+
it "strips characters in a string which are not words" do
|
229
|
+
string = "T!h\"e r£ai$n i%n Spa^in st&*a(y)s ma-in=!ly in t@+he p{}l[]ai#n"
|
230
|
+
expect(string.strip_non_word_chars).to eq("TheraininSpainstaysmainlyintheplain")
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
data/unicode_titlecase.gemspec
CHANGED
@@ -6,11 +6,13 @@ require 'unicode_titlecase/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "unicode_titlecase"
|
8
8
|
gem.version = UnicodeTitlecase::VERSION
|
9
|
-
gem.authors = ["Chong-Yee Khoo"]
|
9
|
+
gem.authors = ["Dr Chong-Yee Khoo"]
|
10
10
|
gem.email = ["mail@cykhoo.com"]
|
11
|
-
gem.description = %q{
|
12
|
-
gem.summary = %q{
|
13
|
-
|
11
|
+
gem.description = %q{Gem to enable easy title casing of strings containing Unicode text.}
|
12
|
+
gem.summary = %q{This gem patches the String class to provide a unicode_titlecase method, \
|
13
|
+
which returns a string that is 'title cased': the first letter in each \
|
14
|
+
significant word is in capitals with the rest in lowercase.}
|
15
|
+
gem.homepage = "http://github.com/cantab/unicode_titlecase"
|
14
16
|
|
15
17
|
gem.files = `git ls-files`.split($/)
|
16
18
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode_titlecase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Chong-Yee Khoo
|
8
|
+
- Dr Chong-Yee Khoo
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
description:
|
62
|
+
description: Gem to enable easy title casing of strings containing Unicode text.
|
63
63
|
email:
|
64
64
|
- mail@cykhoo.com
|
65
65
|
executables: []
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- .gitignore
|
70
70
|
- .rspec
|
71
71
|
- .ruby-version
|
72
|
+
- .travis.yml
|
72
73
|
- Gemfile
|
73
74
|
- LICENSE.txt
|
74
75
|
- README.md
|
@@ -82,9 +83,10 @@ files:
|
|
82
83
|
- spec/examples/standard_examples.yaml
|
83
84
|
- spec/examples/unicode_examples.yaml
|
84
85
|
- spec/spec_helper.rb
|
86
|
+
- spec/string_misc_methods_spec.rb
|
85
87
|
- spec/unicode_titlecase_spec.rb
|
86
88
|
- unicode_titlecase.gemspec
|
87
|
-
homepage: http://github.com/
|
89
|
+
homepage: http://github.com/cantab/unicode_titlecase
|
88
90
|
licenses: []
|
89
91
|
post_install_message:
|
90
92
|
rdoc_options: []
|
@@ -98,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
100
|
version: '0'
|
99
101
|
segments:
|
100
102
|
- 0
|
101
|
-
hash: -
|
103
|
+
hash: -3799941477510380033
|
102
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
105
|
none: false
|
104
106
|
requirements:
|
@@ -107,13 +109,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
version: '0'
|
108
110
|
segments:
|
109
111
|
- 0
|
110
|
-
hash: -
|
112
|
+
hash: -3799941477510380033
|
111
113
|
requirements: []
|
112
114
|
rubyforge_project:
|
113
115
|
rubygems_version: 1.8.23
|
114
116
|
signing_key:
|
115
117
|
specification_version: 3
|
116
|
-
summary:
|
118
|
+
summary: ! 'This gem patches the String class to provide a unicode_titlecase method,
|
119
|
+
\ which returns a string that is ''title cased'': the first letter in each \ significant
|
120
|
+
word is in capitals with the rest in lowercase.'
|
117
121
|
test_files:
|
118
122
|
- spec/examples/bigword_examples.yaml
|
119
123
|
- spec/examples/capitalisation_examples.yaml
|
@@ -121,4 +125,5 @@ test_files:
|
|
121
125
|
- spec/examples/standard_examples.yaml
|
122
126
|
- spec/examples/unicode_examples.yaml
|
123
127
|
- spec/spec_helper.rb
|
128
|
+
- spec/string_misc_methods_spec.rb
|
124
129
|
- spec/unicode_titlecase_spec.rb
|