forked from SeasideSt/Grease
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGRSignPrinter.class.st
More file actions
39 lines (33 loc) · 881 Bytes
/
GRSignPrinter.class.st
File metadata and controls
39 lines (33 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Class {
#name : 'GRSignPrinter',
#superclass : 'GRPrinter',
#instVars : [
'negativePrinter',
'positivePrinter'
],
#category : 'Grease-Core-Text',
#package : 'Grease-Core',
#tag : 'Text'
}
{ #category : 'initialization' }
GRSignPrinter >> initialize [
super initialize.
self negativePrinter: $-.
self positivePrinter: nil
]
{ #category : 'accessing' }
GRSignPrinter >> negativePrinter: aPrinter [
"The printer to be used when the number is negative."
negativePrinter := aPrinter
]
{ #category : 'accessing' }
GRSignPrinter >> positivePrinter: aPrinter [
"The printer to be used when the number is zero or positive."
positivePrinter := aPrinter
]
{ #category : 'printing' }
GRSignPrinter >> print: anObject on: aStream [
anObject negative
ifTrue: [ negativePrinter print: anObject on: aStream ]
ifFalse: [ positivePrinter print: anObject on: aStream ]
]