Skip to content

Instantly share code, notes, and snippets.

@edcrypt
Created July 25, 2019 15:31
Show Gist options
  • Save edcrypt/feddaa3414329aae9b257bf8decae194 to your computer and use it in GitHub Desktop.
Save edcrypt/feddaa3414329aae9b257bf8decae194 to your computer and use it in GitHub Desktop.
Object subclass: #Artist
instanceVariableNames: 'tracks'
methods for: 'initialising'
initialize
tracks := OrderedCollection new.
^self
methods for: 'checking'
invariant
^(tracks isMemberOf: OrderedCollection) and: [
tracks allSatisfy: [:each | each isKindOf: Track]]
methods for: 'accessing tracks'
addTrack: aTrack.
tracks add: aTrack.
^track
tracksDo: doBlock
tracks do: doBlock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment