string_utils 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/README CHANGED
@@ -2,7 +2,12 @@ StringUtils gem repo
2
2
 
3
3
  StringUtils is a library that allows various string manipulation
4
4
 
5
- Example usage:
5
+ Usage:
6
6
 
7
- * StringUtils.truncate("hello world", 10, "...") #=> "hello..."
8
- * StringUtils.normalize_name "\302\240 Gran Via/Avda.de Asturias " #=> :Gran Via / Avda. de Asturias"
7
+ $ gem install string_utils
8
+
9
+ In your project:
10
+
11
+ require 'string_utils'
12
+ StringUtils.truncate("hello world", 10, "...") #=> "hello..."
13
+ StringUtils.normalize_name "\302\240 Gran Via/Avda.de Asturias " #=> :Gran Via / Avda. de Asturias"
@@ -53,7 +53,7 @@ module StringUtils
53
53
 
54
54
  if options[:titleize]
55
55
  value = value.titleize
56
- value.gsub!(/#{WHITESPACE_MATCHER}(Of|And|A)#{WHITESPACE_MATCHER}/) { |m| " #{m.downcase} " }
56
+ value.gsub!(/#{WHITESPACE_MATCHER}(Of|And|A|An|The|To)#{WHITESPACE_MATCHER}/) { |m| "#{m.downcase}" }
57
57
  end
58
58
  value.to_s
59
59
  end
@@ -1,3 +1,3 @@
1
1
  module StringUtils
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Gleb Mazovetskiy"]
10
10
  s.email = ["glex.spb@gmail.com"]
11
- s.homepage = "http://github.com/glebm"
11
+ s.homepage = "http://github.com/glebm/string_utils"
12
12
  s.summary = %q{Provides useful string utils like "truncate to word"}
13
13
  s.description = %q{Provides useful string utils like "truncate to word".
14
14
  Compatible with ruby >= 1.8. Benefits from active_support if available on ruby < 1.9.
@@ -9,11 +9,15 @@ describe "StringUtils" do
9
9
  end
10
10
 
11
11
  it 'normalizes periods, commas and /' do
12
- StringUtils.normalize_name("Av . Valle , Tetuan.Aqui ,a").should == "Av. Valle, Tetuan. Aqui, a"
12
+ StringUtils.normalize_name("Av . Valle ,\302\240\302\240 Tetuan.Aqui ,a").should == "Av. Valle, Tetuan. Aqui, a"
13
13
  end
14
14
 
15
15
  it 'removes trailing and leading [,.]' do
16
16
  StringUtils.normalize_name(".Here,").should == "Here"
17
17
  end
18
+
19
+ it 'does not capitalize prepositions' do
20
+ StringUtils.normalize_name("Tom AND Jerry", :titleize => true).should == "Tom and Jerry"
21
+ end
18
22
  end
19
23
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gleb Mazovetskiy
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-07 00:00:00 +01:00
18
+ date: 2010-12-10 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,7 @@ files:
91
91
  - test/normalize_name_spec.rb
92
92
  - test/truncate_spec.rb
93
93
  has_rdoc: true
94
- homepage: http://github.com/glebm
94
+ homepage: http://github.com/glebm/string_utils
95
95
  licenses: []
96
96
 
97
97
  post_install_message: