titleize 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,5 +4,5 @@ README.txt
4
4
  Rakefile
5
5
  lib/titleize.rb
6
6
  spec/spec.opts
7
- spec/spec/titleize_spec.rb
7
+ spec/titleize_spec.rb
8
8
  spec/spec_helper.rb
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  desc "Run all specs"
14
14
  Spec::Rake::SpecTask.new('spec') do |t|
15
- t.spec_files = FileList['spec/**/*.rb']
15
+ t.spec_files = FileList['spec/*_spec.rb']
16
16
  t.spec_opts = ['--options', "spec/spec.opts"]
17
17
  end
18
18
 
@@ -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.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..-1].each_with_index do |phrase, index|
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__) + "/../spec_helper.rb"
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.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: 2008-05-22 00:00:00 -04:00
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.5.3
23
+ version: 1.9.0
44
24
  version:
45
- description: Adds String#titleize for creating properly capitalized titles. It can be called as Titleize.titleize or "a string".titleize. It is also aliased as titlecase. The list of "small words" which are not capped comes from the New York Times Manual of Style, plus 'vs' and 'v'. If loaded in a Rails environment, it modifies Inflector.titleize. Based on TitleCase.pl by John Gruber. http://daringfireball.net/2008/05/title_case
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/spec/titleize_spec.rb
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.0.1
81
+ rubygems_version: 1.3.5
89
82
  signing_key:
90
- specification_version: 2
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
@@ -1,3 +0,0 @@
1
- �J �E�)E������?l��qw�b�f2�#���ٳ��y�k�L
2
- _��ށ��Gl�X� �筥TRuq�}�9��� -�Nc7<f"��ThWc�C�g�˾՞��$?���Z�(,d�ud�ۖ_���`t��+�=J�
3
- %� �p�u�s����ϯ����.��h���l�n��T������/��w��j�3�boy���o��o�2V�g┿���ݢ6�CA���'�}QĪ;c���?jt��(<%