diff options
| author | Eugen Wissner <belka@caraus.de> | 2025-11-21 22:26:28 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2025-11-21 22:26:28 +0100 |
| commit | 8568518b57dba05500b63a4e471f8fa65883d10a (patch) | |
| tree | 59681b400bccd6fd1299b3c22443c2ddf6f1b378 /pharo-mooc/contact-book/src/ContactBook/Contact.class.st | |
| parent | c03c9f8b886c0e8eca5a701c0ca941e05e0b6285 (diff) | |
| download | book-exercises-8568518b57dba05500b63a4e471f8fa65883d10a.tar.gz | |
Add pharo contact book
Diffstat (limited to 'pharo-mooc/contact-book/src/ContactBook/Contact.class.st')
| -rw-r--r-- | pharo-mooc/contact-book/src/ContactBook/Contact.class.st | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/pharo-mooc/contact-book/src/ContactBook/Contact.class.st b/pharo-mooc/contact-book/src/ContactBook/Contact.class.st new file mode 100644 index 0000000..67ca674 --- /dev/null +++ b/pharo-mooc/contact-book/src/ContactBook/Contact.class.st @@ -0,0 +1,62 @@ +" +I represent a person with a name and an email address. I'm usually +part of a contact book. +" +Class { + #name : 'Contact', + #superclass : 'Object', + #instVars : [ + 'fullname', + 'email' + ], + #category : 'ContactBook', + #package : 'ContactBook' +} + +{ #category : 'instance creation' } +Contact class >> newNamed: aNameString email: anEmailString [ + ^ self new + fullname: aNameString; + email: anEmailString; + yourself +] + +{ #category : 'accessing' } +Contact >> email [ + + ^ email +] + +{ #category : 'accessing' } +Contact >> email: anObject [ + + email := anObject +] + +{ #category : 'accessing' } +Contact >> fullname [ + + ^ fullname +] + +{ #category : 'accessing' } +Contact >> fullname: aString [ + + fullname := aString +] + +{ #category : 'as yet unclassified' } +Contact >> gravatarUrl [ + ^ 'http://www.gravatar.com/avatar/', + (MD5 hashMessage: email asString trimBoth asLowercase) hex, + '.jpg' +] + +{ #category : 'accessing' } +Contact >> printOn: aStream [ + aStream + nextPutAll: self fullname; + nextPutAll: ' <'; + nextPutAll: self email; + nextPutAll: '>' +] |
