bougyman-name_parse 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/AUTHORS CHANGED
@@ -1,5 +1,5 @@
1
1
  Following persons have contributed to name_parse.
2
2
  (Sorted by number of submitted patches, then alphabetically)
3
3
 
4
- 5 TJ Vanderpoel <bougy.man@gmail.com>
4
+ 7 TJ Vanderpoel <bougy.man@gmail.com>
5
5
  2 Jayson Vaughn (thedonvaughn) <jayson.vaughn@gmail.com>
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ [5d85b44 | Thu May 07 03:14:31 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
2
+
3
+ * methodized when match target for first_name. TODO: make the other when matchers follow the same format
4
+
5
+ [09dee2a | Wed May 06 21:05:00 UTC 2009] TJ Vanderpoel <bougy.man@gmail.com>
6
+
7
+ * Version 0.0.3
8
+
1
9
  [9481b20 | Wed May 06 21:04:11 UTC 2009] Jayson Vaughn (thedonvaughn) <jayson.vaughn@gmail.com>
2
10
 
3
11
  * added bacon task back from FSR, added Bacon.summary_on_exit to spec/helper.rb
data/Rakefile CHANGED
@@ -31,7 +31,7 @@ GEMSPEC = Gem::Specification.new{|s|
31
31
  s.email = 'bougy.man@gmail.com'
32
32
  s.homepage = 'http://github.com/bougyman/name_parse'
33
33
  s.platform = Gem::Platform::RUBY
34
- s.version = (ENV['PROJECT_VERSION'] || Date.today.strftime("%Y.%m.%d"))
34
+ s.version = (ENV['PROJECT_VERSION'] || Object.const_get(PROJECT_MODULE)::VERSION)
35
35
  s.files = `git ls-files`.split("\n").sort.reject { |f| IGNORE_FILES.detect { |exp| f.match(exp) } }
36
36
  s.has_rdoc = true
37
37
  s.require_path = 'lib'
@@ -14,6 +14,15 @@ module NameParse
14
14
  def first_name_re
15
15
  /\w[-.'\w]+/
16
16
  end
17
+
18
+ def first_last(match = nil)
19
+ if match.nil?
20
+ /^(#{first_name_re})\s+(#{last_name_re})$/
21
+ else
22
+ @matched = :first_last
23
+ @first, @last = match.to_a[1 .. 2]
24
+ end
25
+ end
17
26
 
18
27
  def last_name_re
19
28
  /(?:(?:v[ao]n(?:\s+der?)?|de\s+la)\s+)?\w[-.'\w]+/i
@@ -31,9 +40,8 @@ module NameParse
31
40
  def parse(name)
32
41
  case name
33
42
  # just "Firstname Lastname"
34
- when /^(#{first_name_re})\s+(#{last_name_re})$/
35
- @first, @last = $1, $2
36
- @matched = :first_last
43
+ when first_last
44
+ first_last($~)
37
45
  # Catch names with prefixes, no comma
38
46
  when /^(#{prefix_re})\s+(#{first_name_re})\s+(#{last_name_re})$/
39
47
  @prefix, @first, @last = $1, $2, $3
@@ -1,3 +1,3 @@
1
1
  module NameParse
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/name_parse.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{name_parse}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Vanderpoel"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bougyman-name_parse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Vanderpoel