Improved printing.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-11-26 11:21:51 -05:00
parent 1be8c6ba58
commit 5feee250e4
3 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,9 @@
accessing
printOn: aStream
super initialize.
^ aStream nextPutAll: self cards printString
self class suits keysDo: [ :suit |
aStream
nextPutAll: (self stockCardsInSuit: suit);
nextPutAll: String cr.
].
^ aStream contents.

View File

@ -0,0 +1,7 @@
accessing
stockCardsInSuit: aString
| response suitCards |
response := '' writeStream.
suitCards := self stock select: [ :card | card endsWith: aString ].
suitCards do: [ :card | response nextPutAll: card ].
^ response contents

View File

@ -0,0 +1,6 @@
accessing
uiCardsFor: aView
<gtView>
^ aView text
title: 'Cards';
text: [ self printString ]