titleize 1.0.0 → 1.0.1
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.
- data/Manifest.txt +1 -1
- data/Rakefile +1 -1
- data/lib/titleize.rb +2 -2
- data/spec/{spec/titleize_spec.rb → titleize_spec.rb} +9 -1
- metadata +22 -29
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -3
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/lib/titleize.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#
|
6
6
|
# If loaded in a Rails environment, it modifies Inflector.titleize.
|
7
7
|
module Titleize
|
8
|
-
VERSION = '1.0.
|
8
|
+
VERSION = '1.0.1'
|
9
9
|
SMALL_WORDS = %w{a an and as at but by en for if in of on or the to v v. via vs vs.}
|
10
10
|
|
11
11
|
extend self
|
@@ -51,7 +51,7 @@ module Titleize
|
|
51
51
|
|
52
52
|
# rejoin phrases that were split on the '.' from a small word
|
53
53
|
if phrases.size > 1
|
54
|
-
phrases[0..-
|
54
|
+
phrases[0..-2].each_with_index do |phrase, index|
|
55
55
|
if SMALL_WORDS.include?(phrase.split.last.downcase)
|
56
56
|
phrases[index] << " " + phrases.slice!(index + 1)
|
57
57
|
end
|
@@ -2,11 +2,13 @@ module Inflector
|
|
2
2
|
#stub
|
3
3
|
end
|
4
4
|
|
5
|
-
require File.dirname(__FILE__) + "
|
5
|
+
require File.dirname(__FILE__) + "/spec_helper.rb"
|
6
6
|
|
7
7
|
SMALL_WORDS = %w{a an and as at but by en for if in of on or the to v v. via vs vs.}
|
8
8
|
|
9
9
|
describe Titleize do
|
10
|
+
include Titleize
|
11
|
+
|
10
12
|
describe "phrases" do
|
11
13
|
it "should return an array" do
|
12
14
|
phrases("a little sentence").should be_an_instance_of(Array)
|
@@ -43,6 +45,10 @@ describe Titleize do
|
|
43
45
|
phrases("this: that vs. him. no. why?").should ==
|
44
46
|
["this:", "that vs. him.", "no.", "why?"]
|
45
47
|
end
|
48
|
+
|
49
|
+
it "should handle punctuation combined with a small word as the last word" do
|
50
|
+
phrases("this. that of").should == ["this.", "that of"]
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
describe "titleize" do
|
@@ -152,6 +158,8 @@ describe Titleize do
|
|
152
158
|
end
|
153
159
|
|
154
160
|
describe Inflector do
|
161
|
+
include Inflector
|
162
|
+
|
155
163
|
describe "titleize" do
|
156
164
|
before(:each) do
|
157
165
|
@title = "active_record and ActiveResource"
|
metadata
CHANGED
@@ -1,48 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: titleize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Grant Hollingworth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
- |
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDMjCCAhqgAwIBAgIBADANBgkqhkiG9w0BAQUFADA/MQ4wDAYDVQQDDAVncmFu
|
14
|
-
dDEYMBYGCgmSJomT8ixkARkWCGFudGlmbHV4MRMwEQYKCZImiZPyLGQBGRYDb3Jn
|
15
|
-
MB4XDTA4MDUyMjE3MTUzMloXDTA5MDUyMjE3MTUzMlowPzEOMAwGA1UEAwwFZ3Jh
|
16
|
-
bnQxGDAWBgoJkiaJk/IsZAEZFghhbnRpZmx1eDETMBEGCgmSJomT8ixkARkWA29y
|
17
|
-
ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK/iuhFkPtanxhB6Ee7Z
|
18
|
-
t/wG8go7TMNR9R7BBnR72CX0K+y5he/3z9y1l4rojCDbKb8mHMkvlETvmRmpM0DR
|
19
|
-
3xbZbLnMv5rxWAhviD1gRcYKbKkiPCmCTftOlS338DF/8GBDkPXZu7nejNLhupKB
|
20
|
-
uEYAy1ba1ZD1a2VRQRXNtNvMtBGibncPnLOCgjoKb9a8LWJIqLGejBwsKU9SoJkm
|
21
|
-
uG+PW9VpzoTmjKE1lMjzgvV5dWpNibOQEf7gar02UP/Fr9QalK+CfzlabPYex5KE
|
22
|
-
Tkv8SF702tePizkXEQihZsBSJVMH/8LDEPGLHpqSQ3HL8iQBH4w15QKIuCetVG1Q
|
23
|
-
iUECAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFIsp
|
24
|
-
OtbjXDikKb9j+TIWqyB1X6bcMA0GCSqGSIb3DQEBBQUAA4IBAQAHIP292bO01VoL
|
25
|
-
ppuXmlPDW9GvYpQurK0zpDbzw/FlFIwhnbym3MntzcOfyVKfXUUfhUjIPhPmQ4Ax
|
26
|
-
QEPyZriTgmk1UfdxcjFPYEUz+kL3k6G4jOwN1qYGD6sCW0AHe5S93Bw81fXz7v2w
|
27
|
-
TMg1zy30CHct6LkhYSvdAmBSQdB+JROCGQ+87bYP5UmmwD7UM+lep61LbMhlJCJq
|
28
|
-
SdS8+20R/tshERtF5QHqRLlB2bIO7eRBJ9eR/bRqUw5O9wrp/owFE1W5P/k8HkK6
|
29
|
-
GHeVld4eadHrZPAOvHz4O1kUZca/DXaUkjn0yDoEOR/vXr5/WdPas6fyWM7k1YOR
|
30
|
-
OQhV/wB5
|
31
|
-
-----END CERTIFICATE-----
|
10
|
+
cert_chain: []
|
32
11
|
|
33
|
-
date:
|
12
|
+
date: 2009-10-14 00:00:00 -04:00
|
34
13
|
default_executable:
|
35
14
|
dependencies:
|
36
15
|
- !ruby/object:Gem::Dependency
|
37
16
|
name: hoe
|
17
|
+
type: :development
|
38
18
|
version_requirement:
|
39
19
|
version_requirements: !ruby/object:Gem::Requirement
|
40
20
|
requirements:
|
41
21
|
- - ">="
|
42
22
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.
|
23
|
+
version: 1.9.0
|
44
24
|
version:
|
45
|
-
description:
|
25
|
+
description: |-
|
26
|
+
Adds String#titleize for creating properly capitalized titles.
|
27
|
+
It can be called as Titleize.titleize or "a string".titleize. It is also
|
28
|
+
aliased as titlecase.
|
29
|
+
|
30
|
+
The list of "small words" which are not capped comes from the New York Times
|
31
|
+
Manual of Style, plus 'vs' and 'v'.
|
32
|
+
|
33
|
+
If loaded in a Rails environment, it modifies Inflector.titleize.
|
34
|
+
|
35
|
+
Based on TitleCase.pl by John Gruber.
|
36
|
+
http://daringfireball.net/2008/05/title_case
|
46
37
|
email:
|
47
38
|
- grant@antiflux.org
|
48
39
|
executables: []
|
@@ -60,10 +51,12 @@ files:
|
|
60
51
|
- Rakefile
|
61
52
|
- lib/titleize.rb
|
62
53
|
- spec/spec.opts
|
63
|
-
- spec/
|
54
|
+
- spec/titleize_spec.rb
|
64
55
|
- spec/spec_helper.rb
|
65
56
|
has_rdoc: true
|
66
57
|
homepage: http://rubyforge.org/projects/titleize/
|
58
|
+
licenses: []
|
59
|
+
|
67
60
|
post_install_message:
|
68
61
|
rdoc_options:
|
69
62
|
- --main
|
@@ -85,9 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
78
|
requirements: []
|
86
79
|
|
87
80
|
rubyforge_project: titleize
|
88
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.3.5
|
89
82
|
signing_key:
|
90
|
-
specification_version:
|
83
|
+
specification_version: 3
|
91
84
|
summary: Adds String#titleize for creating properly capitalized titles
|
92
85
|
test_files: []
|
93
86
|
|
data.tar.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
G*�~e쫇���kx �lvѪQ|:���C=-W/L���(#�N��LgS�{��`=��씯<��0}�<�r��k�N��th��V��y%�Y�S�@������8�]���(%�5-lX�|�?-�졉�ʒ��s�,t;��<��[z�:�{y6�voUk�s&M�:[�m ��ё�.�������������^��f��4Αo�\�Uq�`����L�>b��a�9�r� �3q'%�����!��(
|
metadata.gz.sig
DELETED