Sha256: 175b06d59cbe73758388cfbec2572caee341b4bcadc0aec606be5c4731eb7e40

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

Smalltalk current createPackage: 'Kernel-Announcements' properties: #{}!
Object subclass: #AnnouncementSubscription
	instanceVariableNames: 'block announcementClass'
	package: 'Kernel-Announcements'!

!AnnouncementSubscription methodsFor: 'accessing'!

announcementClass
	^announcementClass
!

announcementClass: aClass
	announcementClass := aClass
!

block
	^block
!

block: aBlock
	block := aBlock
! !

!AnnouncementSubscription methodsFor: 'announcing'!

deliver: anAnnouncement
	(self handlesAnnouncement: anAnnouncement)
		ifTrue: [self block value: anAnnouncement]
!

handlesAnnouncement: anAnnouncement
	^anAnnouncement isKindOf: self announcementClass
! !

Object subclass: #Announcer
	instanceVariableNames: 'registry subscriptions'
	package: 'Kernel-Announcements'!

!Announcer methodsFor: 'announcing'!

announce: anAnnouncement
	subscriptions do: [:each |
		each deliver: anAnnouncement]
! !

!Announcer methodsFor: 'initialization'!

initialize
	super initialize.
	subscriptions := Array new
! !

!Announcer methodsFor: 'subscribing'!

on: aClass do: aBlock
	subscriptions add: (AnnouncementSubscription new
		block: aBlock;
		announcementClass: aClass;
		yourself)
! !

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
mdbe-0.1.0 public/amber/st/Kernel-Announcements.st
maglev-database-explorer-0.0.5 public/amber/st/Kernel-Announcements.st
maglev-database-explorer-0.0.4 public/amber/st/Kernel-Announcements.st
maglev-database-explorer-0.0.3 public/amber/st/Kernel-Announcements.st
maglev-database-explorer-0.0.2 public/amber/st/Kernel-Announcements.st
maglev-database-explorer-0.0.1 public/amber/st/Kernel-Announcements.st
resin-0.2.2 amber/st/Kernel-Announcements.st