Accessors and first utilities.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-28 11:56:54 -05:00
parent bed5c107ee
commit 62fa2ab8b9

View File

@ -0,0 +1,78 @@
Class {
#name : #HlPerson,
#superclass : #Object,
#instVars : [
'givenName',
'familyName',
'metadata'
],
#category : #Holonica
}
{ #category : #accessing }
HlPerson class >> fromListName [
]
{ #category : #accessing }
HlPerson class >> fromListName: aString [
| allNames |
allNames := aString substrings
collect: [:each | each first asString, each allButFirst asLowercase ].
allNames size = 4
ifTrue: [
^ self new
givenName: allNames first, ' ', allNames second;
familyName: allNames third, ' ', allNames fourth
].
allNames size = 3
ifTrue: [
^ self new
givenName: allNames first, ' ', allNames second;
familyName: allNames third.
].
allNames size = 2
ifTrue: [
^ self new
givenName: allNames first;
familyName: allNames second.
].
]
{ #category : #accessing }
HlPerson >> familyName [
^ familyName
]
{ #category : #accessing }
HlPerson >> familyName: anObject [
familyName := anObject
]
{ #category : #accessing }
HlPerson >> givenName [
^ givenName
]
{ #category : #accessing }
HlPerson >> givenName: anObject [
givenName := anObject
]
{ #category : #accessing }
HlPerson >> metadata [
^ metadata
]
{ #category : #accessing }
HlPerson >> metadata: anObject [
metadata := anObject
]