You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/07/31 13:22:01 UTC
[whimsy] branch master updated: Return the unused portions of the
name
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new bbb25ba Return the unused portions of the name
bbb25ba is described below
commit bbb25baab7f75b9653c47c38bb872827f16bd052
Author: Sebb <se...@apache.org>
AuthorDate: Tue Jul 31 14:22:00 2018 +0100
Return the unused portions of the name
---
lib/whimsy/asf/person.rb | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/whimsy/asf/person.rb b/lib/whimsy/asf/person.rb
index 17d4195..a0388dc 100644
--- a/lib/whimsy/asf/person.rb
+++ b/lib/whimsy/asf/person.rb
@@ -89,14 +89,17 @@ module ASF
result['title'] ||= title
end
result['generationQualifier'] = words.pop if words.last =~ SUFFIXES
- result['givenName'] = words.first # TODO does gn allow multiple words?
+ result['givenName'] = words.shift # TODO does gn allow multiple words?
# extract surnames like van Gogh etc
- if words.size >= 4 and words[-3..-2] == %w(de la) or words[-3..-2] == %w(van der) or words[-3..-2] == %w(van de) or words[-3..-2] == %w(van den)
+ if words.size >= 3 and words[-3..-2] == %w(de la) or words[-3..-2] == %w(van der) or words[-3..-2] == %w(van de) or words[-3..-2] == %w(van den)
result['sn'] = words[-3..-1].join(' ')
- elsif words.size >= 3 and %w(van Van de De del Del den le Le).include? words[-2]
+ result['unused'] = words[0..-4]
+ elsif words.size >= 2 and %w(von van Van de De del Del den le Le O).include? words[-2]
result['sn'] = words[-2..-1].join(' ')
+ result['unused'] = words[0..-3]
else
- result['sn'] = words.last
+ result['sn'] = words.pop
+ result['unused'] = words
end
result
end