Skip to content

Commit

Permalink
Add #displayFullString to have an equivalent of #mooseName also usefu…
Browse files Browse the repository at this point in the history
…l for associations
  • Loading branch information
jecisc committed Jun 3, 2024
1 parent 8c7cc68 commit 743a35d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Famix-Traits/FamixTAssociation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ FamixTAssociation >> asAssociationTo: anEntity [
^ self
]

{ #category : #printing }
FamixTAssociation >> displayFullStringOn: aStream [

self source displayFullStringOn: aStream.
aStream nextPutAll: ' -> '.
self target displayFullStringOn: aStream
]

{ #category : #printing }
FamixTAssociation >> displayStringOn: aStream [

Expand Down
17 changes: 17 additions & 0 deletions src/Famix-Traits/FamixTInvocation.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ FamixTInvocation >> candidates: anObject [
candidates value: anObject
]

{ #category : #printing }
FamixTInvocation >> displayFullStringOn: aStream [

self sender
ifNotNil: [ self sender displayFullStringOn: aStream ]
ifNil: [ aStream nextPut: $? ].
aStream nextPutAll: ' -> '.
self receiver
ifNotNil: [ :rcvr | self receiver displayFullStringOn: aStream ]
ifNil: [ aStream nextPut: $? ].
aStream nextPutAll: '.'.

self signature
ifNotNil: [ aStream nextPutAll: (self signature truncateWithElipsisTo: 40) ]
ifNil: [ aStream nextPutAll: ' ? ' ]
]

{ #category : #printing }
FamixTInvocation >> displayStringOn: aStream [

Expand Down
12 changes: 12 additions & 0 deletions src/Moose-Core/MooseObject.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,18 @@ MooseObject >> description: text [
self attributeAt: #privateDescription put: text
]

{ #category : #printing }
MooseObject >> displayFullString [
"Return a name corresponding to the moose name but also for the associations instead of returning #noname"

^ String streamContents: [ :stream | self displayFullStringOn: stream ]
]

{ #category : #printing }
MooseObject >> displayFullStringOn: aStream [
self mooseNameOn: aStream
]

{ #category : #printing }
MooseObject >> displayStringOn: aStream [
self mooseNameOn: aStream
Expand Down

0 comments on commit 743a35d

Please sign in to comment.