12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- Smalltalk createPackage: 'Sedux'!
- Object subclass: #SeduxCreatorClass
- instanceVariableNames: ''
- package: 'Sedux'!
- !SeduxCreatorClass class methodsFor: 'as yet unclassified'!
- << aStoreEnhancer
- ^ aStoreEnhancer next: self
- !
- inject: anObject
- ^ self inject: anObject into: nil
- ! !
- SeduxCreatorClass subclass: #Sedux
- instanceVariableNames: ''
- package: 'Sedux'!
- !Sedux class methodsFor: 'as yet unclassified'!
- dispatch: anAction with: aReceiver fallback: aBlock
- ^ (aReceiver respondsTo: anAction selector)
- ifTrue: [ anAction sendTo: aReceiver ]
- ifFalse: aBlock
- !
- inject: aReducer into: anObject
- "Creates a store, dispatches initiating message"
- ! !
- SeduxCreatorClass subclass: #SeduxDecorator
- instanceVariableNames: 'next'
- package: 'Sedux'!
- !SeduxDecorator methodsFor: 'accessing'!
- next: anObject
- next := anObject
- ! !
- SeduxDecorator class instanceVariableNames: 'next'!
- !SeduxDecorator class methodsFor: 'as yet unclassified'!
- inject: aReducer into: anObject
- ^ SeduxDecoratedStore dispatch: self new next: (self nextInject: aReducer into: anObject)
- !
- next: aStoreCreator
- next := aStoreCreator.
- ^self
- !
- nextInject: aReducer into: anObject
- ^ next inject: aReducer into: anObject
- ! !
- SeduxDecorator subclass: #SeduxFoo
- instanceVariableNames: ''
- package: 'Sedux'!
- Object subclass: #SeduxDecoratedStore
- instanceVariableNames: 'next dispatch'
- package: 'Sedux'!
- !SeduxDecoratedStore methodsFor: 'accessing'!
- dispatch: anAction
- ^ Sedux
- dispatch: anAction
- with: dispatch
- fallback: [ ^ next dispatch: anAction ]
- !
- dispatch: aDispatcher next: aStore
- dispatch := aDispatcher.
- next := aStore
- ! !
- !SeduxDecoratedStore class methodsFor: 'instance creation'!
- dispatch: aDispatcher next: aStore
- ^ self new
- dispatch: aDispatcher next: aStore;
- yourself
- ! !
|