Creation/initialization utilities.
This commit is contained in:
parent
62fa2ab8b9
commit
b90c33bf04
@ -15,30 +15,24 @@ HlPerson class >> fromListName [
|
|||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #initialization }
|
||||||
HlPerson class >> fromListName: aString [
|
HlPerson class >> fromListName: aString [
|
||||||
| allNames |
|
| allNames names |
|
||||||
allNames := aString substrings
|
allNames := aString substrings
|
||||||
collect: [:each | each first asString, each allButFirst asLowercase ].
|
collect: [:each | each first asString, each allButFirst asLowercase ].
|
||||||
allNames size = 4
|
allNames size >= 3
|
||||||
ifTrue: [
|
ifFalse: [
|
||||||
^ self new
|
^ self new
|
||||||
givenName: allNames first, ' ', allNames second;
|
givenName: allNames second;
|
||||||
familyName: allNames third, ' ', allNames fourth
|
familyName: allNames first.
|
||||||
|
].
|
||||||
|
names := '' writeStream.
|
||||||
|
(allNames copyFrom: 3 to: allNames size) do: [:each |
|
||||||
|
names nextPutAll: each, ' '.
|
||||||
].
|
].
|
||||||
allNames size = 3
|
|
||||||
ifTrue: [
|
|
||||||
^ self new
|
^ self new
|
||||||
givenName: allNames first, ' ', allNames second;
|
familyName: allNames first, ' ', allNames second;
|
||||||
familyName: allNames third.
|
givenName: names contents trimmed
|
||||||
].
|
|
||||||
allNames size = 2
|
|
||||||
ifTrue: [
|
|
||||||
^ self new
|
|
||||||
givenName: allNames first;
|
|
||||||
familyName: allNames second.
|
|
||||||
].
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
Loading…
Reference in New Issue
Block a user