Improved printing.
This commit is contained in:
parent
1be8c6ba58
commit
5feee250e4
@ -1,4 +1,9 @@
|
|||||||
accessing
|
accessing
|
||||||
printOn: aStream
|
printOn: aStream
|
||||||
super initialize.
|
super initialize.
|
||||||
^ aStream nextPutAll: self cards printString
|
self class suits keysDo: [ :suit |
|
||||||
|
aStream
|
||||||
|
nextPutAll: (self stockCardsInSuit: suit);
|
||||||
|
nextPutAll: String cr.
|
||||||
|
].
|
||||||
|
^ aStream contents.
|
@ -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
|
@ -0,0 +1,6 @@
|
|||||||
|
accessing
|
||||||
|
uiCardsFor: aView
|
||||||
|
<gtView>
|
||||||
|
^ aView text
|
||||||
|
title: 'Cards';
|
||||||
|
text: [ self printString ]
|
Loading…
Reference in New Issue
Block a user