namor 0.5.0 → 0.5.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/lib/namor/namor.rb CHANGED
@@ -41,9 +41,9 @@ class Namor::Namor
41
41
  def demaiden(lastname)
42
42
  return [nil,nil] unless lastname && !lastname.empty?
43
43
  if lastname =~ /\-/
44
- [lastname.gsub(/ /, ''), lastname.split(/\-/).last.gsub(/ /, '')]
44
+ [lastname.upcase.gsub(/ /, ''), lastname.split(/\-/).last.gsub(/ /, '')]
45
45
  else
46
- [lastname.gsub(/ /, ''), lastname.split(/ /).last]
46
+ [lastname.upcase.gsub(/ /, ''), lastname.split(/ /).last]
47
47
  end
48
48
  end
49
49
 
@@ -62,6 +62,7 @@ class Namor::Namor
62
62
  de_maidened_last = final_cleaning(de_maidened_last)
63
63
 
64
64
  fm = [firstname, middlename].compact.join(' ')
65
+ fm = nil if fm.empty?
65
66
  fullname = [lastname, fm].compact.join(',')
66
67
  nee_fullname = [de_maidened_last, fm].compact.join(',')
67
68
 
@@ -119,8 +120,8 @@ class Namor::Namor
119
120
  ary = assemble(
120
121
  scrub(hash[:first]),
121
122
  scrub(hash[:middle]),
122
- scrub(hash[:last].upcase),
123
- scrub(demaiden(hash[:last].upcase).last)
123
+ scrub(hash[:last]),
124
+ scrub(demaiden(hash[:last]).last)
124
125
  )
125
126
  ary << ary[3].gsub(/\W/, '_')
126
127
  ary << ary[4].gsub(/\W/, '_')
data/lib/namor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Namor
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -87,6 +87,8 @@ describe "name extract" do
87
87
 
88
88
  @namor.extract_from_pieces_with_cluster(:first => 'John', :middle => 'M', :last => 'Smith').should == ['JOHN', 'M', 'SMITH', 'SMITH,JOHN M', 'SMITH,JOHN M', 'SMITH_JOHN_M', 'SMITH_JOHN_M']
89
89
  @namor.extract_from_pieces_with_cluster(:first => 'Susan', :last => 'Smith-Jones').should == ['SUSAN', nil, 'SMITHJONES', 'SMITHJONES,SUSAN', 'JONES,SUSAN', 'SMITHJONES_SUSAN', 'JONES_SUSAN']
90
+
91
+ @namor.extract_from_pieces(:last => 'Smith').should == [nil,nil, 'SMITH', 'SMITH', 'SMITH']
90
92
  end
91
93
 
92
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  segments:
110
110
  - 0
111
- hash: -1676995470774616053
111
+ hash: 4269875274243672429
112
112
  required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  segments:
119
119
  - 0
120
- hash: -1676995470774616053
120
+ hash: 4269875274243672429
121
121
  requirements: []
122
122
  rubyforge_project:
123
123
  rubygems_version: 1.8.24