diff options
Diffstat (limited to 'pharo-mooc/tiny-blog/src/TinyBlog/TBPost.class.st')
| -rw-r--r-- | pharo-mooc/tiny-blog/src/TinyBlog/TBPost.class.st | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/pharo-mooc/tiny-blog/src/TinyBlog/TBPost.class.st b/pharo-mooc/tiny-blog/src/TinyBlog/TBPost.class.st new file mode 100644 index 0000000..08e8247 --- /dev/null +++ b/pharo-mooc/tiny-blog/src/TinyBlog/TBPost.class.st @@ -0,0 +1,121 @@ +Class { + #name : 'TBPost', + #superclass : 'Object', + #instVars : [ + 'title', + 'text', + 'date', + 'category', + 'visible' + ], + #category : 'TinyBlog', + #package : 'TinyBlog' +} + +{ #category : 'instance creation' } +TBPost class >> title: aTitle text: aText [ + ^ self new + title: aTitle; + text: aText; + yourself +] + +{ #category : 'instance creation' } +TBPost class >> title: aTitle text: aText category: aCategory [ + ^ (self title: aTitle text: aText) + category: aCategory; + yourself +] + +{ #category : 'as yet unclassified' } +TBPost class >> unclassifiedTag [ + ^ 'Unclassified' +] + +{ #category : 'action' } +TBPost >> beVisible [ + self visible: true +] + +{ #category : 'accessing' } +TBPost >> category [ + + ^ category +] + +{ #category : 'accessing' } +TBPost >> category: anObject [ + + category := anObject +] + +{ #category : 'accessing' } +TBPost >> date [ + + ^ date +] + +{ #category : 'accessing' } +TBPost >> date: anObject [ + + date := anObject +] + +{ #category : 'initialization' } +TBPost >> initialize [ + super initialize. + self category: self class unclassifiedTag. + self date: Date today. + self notVisible. +] + +{ #category : 'testing' } +TBPost >> isUnclassified [ + ^ self category = self class unclassifiedTag +] + +{ #category : 'testing' } +TBPost >> isVisible [ + ^ self visible +] + +{ #category : 'action' } +TBPost >> notVisible [ + self visible: false +] + +{ #category : 'accessing' } +TBPost >> text [ + + ^ text +] + +{ #category : 'accessing' } +TBPost >> text: anObject [ + + text := anObject +] + +{ #category : 'accessing' } +TBPost >> title [ + + ^ title +] + +{ #category : 'accessing' } +TBPost >> title: anObject [ + + title := anObject +] + +{ #category : 'accessing' } +TBPost >> visible [ + + ^ visible +] + +{ #category : 'accessing' } +TBPost >> visible: anObject [ + + visible := anObject +] |
