Class categories
Last updated at 1:53 am UTC on 14 December 2021
How to create a set of all class categories.
categories := Set new.
Object withAllSubclassesDo: [ :cls|
cls category ifNotNil: [ :category |
categories add: category ] ].
categories asSortedCollection inspect
How to create a set of class categories with a specific prefix in the name
| categories prefix |
prefix := 'Add'.
categories := Set new.
Object withAllSubclassesDo: [ :cls |
cls category ifNotNil: [ :category |
(category beginsWith: prefix) ifTrue:
[categories add: category ]]].
categories asSortedCollection do: [:cat | Transcript show: cat; cr]