string_utils 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module StringUtils
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
data/lib/string_utils.rb CHANGED
@@ -54,6 +54,9 @@ module StringUtils
54
54
  value.gsub!(/^[.,]/, '')
55
55
  value.gsub!(/[.,]$/, '')
56
56
 
57
+ # Remove quote pairs. Imperfect, but good enough
58
+ value.gsub!(/\A['"]+(.*)['"]+\z/, '\1')
59
+
57
60
  # "a ,a" => "a, a"
58
61
  # "a,a" => "a, a"
59
62
  # "a , a" => "a, a"
@@ -9,7 +9,7 @@ describe "StringUtils" do
9
9
  end
10
10
 
11
11
  it 'normalizes periods, commas and /' do
12
- StringUtils.normalize_name("Av . Valle ,\302\240\302\240 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
@@ -19,5 +19,9 @@ describe "StringUtils" do
19
19
  it 'does not capitalize prepositions' do
20
20
  StringUtils.normalize_name("Tom AND Jerry", :titleize => true).should == "Tom and Jerry"
21
21
  end
22
+
23
+ it 'removes trailing and leading quotes' do
24
+ StringUtils.normalize_name(%Q{"'I'm awesome"}).should == "I'm awesome"
25
+ end
22
26
  end
23
27
  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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gleb Mazovetskiy