Skip to content

Commit

Permalink
Add NeoCSVData>>#printOn:
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvc committed Dec 3, 2023
1 parent a8403f2 commit ee6fc9d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions repository/Neo-CSV-Core/NeoCSVData.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,40 @@ NeoCSVData >> headerForPresentation [
ifNil: [ self data ifNotNil: [ (1 to: self data first size) collect: #asString ] ]
]

{ #category : #accessing }
NeoCSVData >> numberOfColumns [
^ header
ifNil: [
self data ifNil: [ 0 ] ifNotNil: [ self data first size ] ]
ifNotNil: [ header size ]
]

{ #category : #accessing }
NeoCSVData >> numberOfRows [
^ data ifNil: [ 0 ] ifNotNil: [ data size ]
]

{ #category : #printing }
NeoCSVData >> printOn: stream [
super printOn: stream.
stream
nextPut: $(;
print: self numberOfRows;
space;
nextPutAll: 'row'.
self numberOfRows = 1 ifFalse: [ stream nextPut: $s ].
stream
space;
nextPut: $x;
space;
print: self numberOfColumns;
space;
nextPutAll: 'column'.
self numberOfColumns = 1 ifFalse: [ stream nextPut: $s ].
stream
nextPut: $)
]

{ #category : #writing }
NeoCSVData >> writeOn: characterWriteStream [
| writer |
Expand Down

0 comments on commit ee6fc9d

Please sign in to comment.