full-name-splitter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +7 -1
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/examples/generate_usernames.rb +42 -0
- data/full-name-splitter.gemspec +8 -7
- metadata +10 -8
data/README.mdown
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
#FullNameSplitter
|
2
|
+
|
1
3
|
*FullNameSplitter* splits full name into first and last name considering name prefixes and initials
|
2
4
|
|
3
5
|
If you include the module it requires attribute accessors first\_name and last\_name and adds #full\_name, #full\_name= to the class
|
@@ -55,4 +57,8 @@ Also you can use splitter directly by calling module function FullNameSplitter::
|
|
55
57
|
If the lib can't split a name correctly, it is possible to split by comma
|
56
58
|
|
57
59
|
FullNameSplitter.split("John Quincy Adams") # => ["John Quincy", "Adams"]
|
58
|
-
FullNameSplitter.split("John, Quincy Adams") # => ["John", "Quincy Adams"]
|
60
|
+
FullNameSplitter.split("John, Quincy Adams") # => ["John", "Quincy Adams"]
|
61
|
+
|
62
|
+
##Copyright
|
63
|
+
|
64
|
+
Created by Pavel Gorbokon. Contributed by Michael S. Klishin and Trevor Creech. Released under the MIT license.
|
data/Rakefile
CHANGED
@@ -14,11 +14,11 @@ begin
|
|
14
14
|
require 'jeweler'
|
15
15
|
Jeweler::Tasks.new do |gemspec|
|
16
16
|
gemspec.name = "full-name-splitter"
|
17
|
-
gemspec.summary = "
|
17
|
+
gemspec.summary = "FullNameSplitter splits full name into first and last name considering name prefixes and initials"
|
18
18
|
gemspec.description = ""
|
19
|
-
gemspec.email = "
|
20
|
-
gemspec.homepage = "http://github.com/
|
21
|
-
gemspec.authors = ["Pavel Gorbokon", "Trevor Creech"]
|
19
|
+
gemspec.email = "pahanix@gmail.com"
|
20
|
+
gemspec.homepage = "http://github.com/pahanix/full-name-splitter"
|
21
|
+
gemspec.authors = ["Pavel Gorbokon", "contributors Michael S. Klishin and Trevor Creech"]
|
22
22
|
end
|
23
23
|
Jeweler::GemcutterTasks.new
|
24
24
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../lib/full_name_splitter.rb'
|
2
|
+
|
3
|
+
|
4
|
+
class Incognito
|
5
|
+
include PersonalIdentity
|
6
|
+
transform :full_name, :to => [:first_name, :last_name]
|
7
|
+
attr_accessor :first_name, :last_name
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
names = [
|
12
|
+
"John Smith",
|
13
|
+
"Kevin Bluth-Funke",
|
14
|
+
|
15
|
+
"Kevin J. O'Connor",
|
16
|
+
"Gabriel Van Helsing",
|
17
|
+
"Pierre de Montesquiou",
|
18
|
+
"Charles d'Artagnan",
|
19
|
+
"Jaazaniah ben Shaphan",
|
20
|
+
"Noda' bi-Yehudah",
|
21
|
+
"Maria del Carmen Menendez",
|
22
|
+
"Alessandro Del Piero",
|
23
|
+
|
24
|
+
"George W Bush",
|
25
|
+
"George H. W. Bush",
|
26
|
+
"James K. Polk",
|
27
|
+
"William Henry Harrison",
|
28
|
+
"John Quincy Adams"
|
29
|
+
]
|
30
|
+
|
31
|
+
usernames = []
|
32
|
+
|
33
|
+
names.each do |full_name|
|
34
|
+
firstname, lastname = FullNameSplitter.split(full_name)
|
35
|
+
firstname = firstname.to_s[0..0]
|
36
|
+
lastname = lastname.gsub(/(?:(?:\w)+\-)?(\w+)/, "\\1").gsub(/[^\w]/, "")
|
37
|
+
usernames << ("#{firstname}.#{lastname}").downcase
|
38
|
+
end
|
39
|
+
|
40
|
+
firstname, lastname = PersonalIdentity[full_name]
|
41
|
+
|
42
|
+
puts usernames
|
data/full-name-splitter.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{full-name-splitter}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Pavel Gorbokon", "Trevor Creech"]
|
12
|
-
s.date = %q{2010-09-
|
11
|
+
s.authors = ["Pavel Gorbokon", "contributors Michael S. Klishin and Trevor Creech"]
|
12
|
+
s.date = %q{2010-09-14}
|
13
13
|
s.description = %q{}
|
14
|
-
s.email = %q{
|
14
|
+
s.email = %q{pahanix@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.mdown"
|
17
17
|
]
|
@@ -29,14 +29,15 @@ Gem::Specification.new do |s|
|
|
29
29
|
"spec/spec.opts",
|
30
30
|
"spec/spec_helper.rb"
|
31
31
|
]
|
32
|
-
s.homepage = %q{http://github.com/
|
32
|
+
s.homepage = %q{http://github.com/pahanix/full-name-splitter}
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
35
|
s.rubygems_version = %q{1.3.7}
|
36
|
-
s.summary = %q{
|
36
|
+
s.summary = %q{FullNameSplitter splits full name into first and last name considering name prefixes and initials}
|
37
37
|
s.test_files = [
|
38
38
|
"spec/lib/full_name_splitter_spec.rb",
|
39
|
-
"spec/spec_helper.rb"
|
39
|
+
"spec/spec_helper.rb",
|
40
|
+
"examples/generate_usernames.rb"
|
40
41
|
]
|
41
42
|
|
42
43
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: full-name-splitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pavel Gorbokon
|
14
|
-
- Trevor Creech
|
14
|
+
- contributors Michael S. Klishin and Trevor Creech
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-14 00:00:00 +03:00
|
20
20
|
default_executable:
|
21
21
|
dependencies: []
|
22
22
|
|
23
23
|
description: ""
|
24
|
-
email:
|
24
|
+
email: pahanix@gmail.com
|
25
25
|
executables: []
|
26
26
|
|
27
27
|
extensions: []
|
@@ -41,8 +41,9 @@ files:
|
|
41
41
|
- spec/lib/full_name_splitter_spec.rb
|
42
42
|
- spec/spec.opts
|
43
43
|
- spec/spec_helper.rb
|
44
|
+
- examples/generate_usernames.rb
|
44
45
|
has_rdoc: true
|
45
|
-
homepage: http://github.com/
|
46
|
+
homepage: http://github.com/pahanix/full-name-splitter
|
46
47
|
licenses: []
|
47
48
|
|
48
49
|
post_install_message:
|
@@ -74,7 +75,8 @@ rubyforge_project:
|
|
74
75
|
rubygems_version: 1.3.7
|
75
76
|
signing_key:
|
76
77
|
specification_version: 3
|
77
|
-
summary:
|
78
|
+
summary: FullNameSplitter splits full name into first and last name considering name prefixes and initials
|
78
79
|
test_files:
|
79
80
|
- spec/lib/full_name_splitter_spec.rb
|
80
81
|
- spec/spec_helper.rb
|
82
|
+
- examples/generate_usernames.rb
|