titleizePTBR 0.0.2 → 1.0.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.
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.gem
2
2
  *.rbc
3
+ *.swp
3
4
  .bundle
4
5
  .config
5
6
  .yardoc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TitleizePTBR
2
2
 
3
- TODO: Write a gem description
3
+ Just a easy way to titleize names for pt-BR. Special hug to [reu](https://github.com/reu) for help on my first gem :D
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,17 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Just call `titleize_pt_br`
22
+
23
+ ``` ruby
24
+ "joão da silva".titleize_pt_br => "João da Silva"
25
+ "ministério das finanças".titleize_pt_br => "Ministério das Finanças"
26
+ "josé do amaral".titleize_pt_br => "José do Amaral"
27
+ "RIO DE JANEIRO".titleize_pt_br => "Rio de Janeiro"
28
+ "Joaquim Dos ANJOS".titleize_pt_br => "Joaquim dos Anjos"
29
+ "morro cabeça no tempo".titleize_pt_br => "Morro Cabeça no Tempo"
30
+ "MARTINS costa e silva".titleize_pt_br => "Martins Costa e Silva"
31
+ ```
22
32
 
23
33
  ## Contributing
24
34
 
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec"
3
+ require "rspec/core/rake_task"
@@ -1,3 +1,3 @@
1
1
  module TitleizePTBR
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/titleizePTBR.rb CHANGED
@@ -6,7 +6,7 @@ module TitleizePTBR
6
6
  gsub(" A ", " a ").
7
7
  gsub(" E ", " e ").
8
8
  gsub(/ D(e|[ao]s?) /, ' d\1 ').
9
- gsub(/ N([ao]s?) /, ' d\1 ').
9
+ gsub(/ N([ao]s?) /, ' n\1 ').
10
10
  gsub(/ Com /, " com ").
11
11
  gsub(" Em ", " em ")
12
12
  end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'titleizePTBR'
3
+ require 'activesupport'
4
+
5
+ describe "genitive article da(s), de, do(s)" do
6
+ context "article da" do
7
+ let(:name) { 'josé da silva'.titleize_pt_br }
8
+ it { name.should == 'José da Silva' }
9
+ end
10
+
11
+ context "article das" do
12
+ let(:name) { 'ministério das finanças'.titleize_pt_br }
13
+ it { name.should == 'Ministério das Finanças' }
14
+ end
15
+
16
+ context "article de" do
17
+ let(:name) { 'RIO DE JANEIRO'.titleize_pt_br }
18
+ it { name.should == 'Rio de Janeiro' }
19
+ end
20
+
21
+ context "article do" do
22
+ let(:name) { 'banco do brasil'.titleize_pt_br }
23
+ it { name.should == 'Banco do Brasil' }
24
+ end
25
+
26
+ context "article dos" do
27
+ let(:name) { 'joaquim dos anjos'.titleize_pt_br }
28
+ it { name.should == 'Joaquim dos Anjos' }
29
+ end
30
+ end
31
+
32
+ describe "locative article no" do
33
+ let(:name) { 'morro cabeça no tempo'.titleize_pt_br }
34
+ it { name.should == 'Morro Cabeça no Tempo' }
35
+ end
36
+
37
+ describe "conjunction e" do
38
+ let(:name) { 'martins da costa e silva'.titleize_pt_br }
39
+ it { name.should == 'Martins da Costa e Silva' }
40
+ end
data/titleizePTBR.gemspec CHANGED
@@ -16,4 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency "rspec"
21
+ gem.add_development_dependency "test-unit"
22
+ gem.add_development_dependency "rake"
23
+ gem.add_dependency('activesupport', '~> 2.2.1')
19
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: titleizePTBR
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,72 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-13 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: test-unit
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: activesupport
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 2.2.1
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 2.2.1
14
78
  description: Just a easy way to titleize names for pt-BR
15
79
  email:
16
80
  - beneti@beneti.com.br
@@ -25,6 +89,7 @@ files:
25
89
  - Rakefile
26
90
  - lib/titleizePTBR.rb
27
91
  - lib/titleizePTBR/version.rb
92
+ - spec/titleizePTBR/titleizePTBR_spec.rb
28
93
  - titleizePTBR.gemspec
29
94
  homepage: ''
30
95
  licenses: []
@@ -38,16 +103,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
38
103
  - - ! '>='
39
104
  - !ruby/object:Gem::Version
40
105
  version: '0'
106
+ segments:
107
+ - 0
108
+ hash: 2739724172461865564
41
109
  required_rubygems_version: !ruby/object:Gem::Requirement
42
110
  none: false
43
111
  requirements:
44
112
  - - ! '>='
45
113
  - !ruby/object:Gem::Version
46
114
  version: '0'
115
+ segments:
116
+ - 0
117
+ hash: 2739724172461865564
47
118
  requirements: []
48
119
  rubyforge_project:
49
120
  rubygems_version: 1.8.24
50
121
  signing_key:
51
122
  specification_version: 3
52
123
  summary: Just a easy way to titleize names for pt-BR
53
- test_files: []
124
+ test_files:
125
+ - spec/titleizePTBR/titleizePTBR_spec.rb