Skip to content

Commit

Permalink
small improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 committed Jul 31, 2024
1 parent b417590 commit e6eace7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 19 deletions.
4 changes: 3 additions & 1 deletion src/Pyramid-Bloc/PyramidLibraryDefault.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ PyramidLibraryDefault >> pragmaCategory: aSymbol withIcon: anIcon [
PyramidLibraryElement new
icon: (Smalltalk ui icons iconNamed:
method methodClass soleInstance systemIconName);
name: method selector;
name: ('<1s> (<2s>)'
expandMacrosWith: method selector
with: method methodClass name);
block: [
(method methodClass soleInstance perform:
method selector) materializeAsBlElement ];
Expand Down
34 changes: 24 additions & 10 deletions src/Pyramid/PyramidExternalRessourceProxy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ PyramidExternalRessourceProxy class >> fromSource: aSource [
{ #category : #'instance creation' }
PyramidExternalRessourceProxy class >> fromTarget: aTarget selector: aSelector arguments: aCollection [

^ self fromSource: (PyramidExternalRessourceSource target: aTarget selector: aSelector arguments: aCollection)
^ self fromTarget: aTarget selector: aSelector arguments: aCollection withPostConstructionBlock: nil
]

{ #category : #'instance creation' }
PyramidExternalRessourceProxy class >> fromTarget: aTarget selector: aSelector arguments: aCollection withPostConstructionBlock: aBlock [

^ self fromSource: (PyramidExternalRessourceSource
target: aTarget
selector: aSelector
arguments: aCollection
postConstructionBlock: aBlock)
]

{ #category : #converting }
Expand All @@ -31,15 +41,19 @@ PyramidExternalRessourceProxy >> asStashConstructor [

{ #category : #'as yet unclassified' }
PyramidExternalRessourceProxy >> doesNotUnderstand: aMessage [
| returnValue |
(self pyramidExternalRessourceObject respondsTo: aMessage selector) ifFalse: [ ^ super doesNotUnderstand: aMessage ].

returnValue := self pyramidExternalRessourceObject
perform: aMessage selector
withEnoughArguments: aMessage arguments.
returnValue == object
ifTrue: [ ^ self ].
^ returnValue

| returnValue target |
target := self pyramidExternalRessourceObject.
self pyramidExternalRessourceObject isPyramidProxy ifTrue: [ ^ target doesNotUnderstand: aMessage ].

(target respondsTo: aMessage selector)
ifFalse: [ ^ super doesNotUnderstand: aMessage ].

returnValue := target
perform: aMessage selector
withEnoughArguments: aMessage arguments.
returnValue == object ifTrue: [ ^ self ].
^ returnValue
]

{ #category : #'instance creation' }
Expand Down
29 changes: 21 additions & 8 deletions src/Pyramid/PyramidExternalRessourceSource.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,33 @@ PyramidExternalRessourceSource class >> formFromFileNamed: aFileReference [
]

{ #category : #initialization }
PyramidExternalRessourceSource class >> target: aClass selector: aSelector [
PyramidExternalRessourceSource class >> target: anObject selector: aSelector [

^ self new
target: aClass;
selector: aSelector;
yourself
^ self
target: anObject
selector: aSelector
arguments: { }
postConstructionBlock: nil
]

{ #category : #initialization }
PyramidExternalRessourceSource class >> target: anObject selector: aSelector arguments: anArray [

^ self
target: anObject
selector: aSelector
arguments: anArray
postConstructionBlock: nil
]

{ #category : #initialization }
PyramidExternalRessourceSource class >> target: aClass selector: aSelector arguments: anArray [
PyramidExternalRessourceSource class >> target: anObject selector: aSelector arguments: anArray postConstructionBlock: aBlock [

^ self new
target: aClass;
target: anObject;
selector: aSelector;
arguments: anArray;
postConstructionBlock: aBlock;
yourself
]

Expand Down Expand Up @@ -68,7 +80,8 @@ PyramidExternalRessourceSource >> getRessource [
ressource := self target
perform: self selector
withArguments: self arguments.
self postConstructionBlock ifNotNil: [ :block | block value: ressource ].
self postConstructionBlock ifNotNil: [ :block |
block value: ressource ].
^ ressource
]

Expand Down

0 comments on commit e6eace7

Please sign in to comment.