X Tutup
Skip to content

Commit a0cbf94

Browse files
committed
Add #asMethodReturningString:named:
Fixes SeasideSt#141
1 parent 2a4832c commit a0cbf94

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
file library
2+
asMethodReturningString: aByteArrayOrString named: aSymbol
3+
"Generates the source of a method named aSymbol that returns aByteArrayOrString as a String.
4+
5+
This implementation answers a String formatted like so
6+
7+
aSymbol
8+
^ aByteArrayOrString
9+
10+
Subclasses need to override this method if the dialect needs changes to support Unicode string literals"
11+
^ String streamContents: [ :stream |
12+
stream
13+
nextPutAll: aSymbol;
14+
nextPut: Character cr.
15+
stream
16+
tab;
17+
nextPutAll: '^ '''.
18+
aByteArrayOrString greaseString do: [ :each |
19+
each = $' ifTrue: [ stream nextPut: $' ].
20+
stream nextPut: each ].
21+
stream nextPut: $' ]

0 commit comments

Comments
 (0)
X Tutup