Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enh]: Magritte Field Adding - Don't Set Default for Nils #44

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions repository/Neo-CSV-Magritte/MAElementDescription.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ MAElementDescription >> defaultCsvReader [

^ [ :trimmed | self fromString: trimmed ].
]

{ #category : #'*Neo-CSV-Magritte' }
MAElementDescription >> fromCSV: aStringOrNil [
| value |
(aStringOrNil isNil or: [ aStringOrNil isEmpty ]) ifTrue: [ ^ nil ].
value := self csvReader cull: aStringOrNil trimmed cull: self.
(self default = value and: [ self shouldCacheDefault not ]) ifTrue: [ ^ nil ].
^ value
"Implementation note: this was extracted from NeoCSVReader's Magritte field adding because it is useful in other places e.g. MACSVImporter"
]
2 changes: 1 addition & 1 deletion repository/Neo-CSV-Magritte/NeoCSVReader.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ NeoCSVReader >> addFieldDescribedByMagritte: aDescription [
converter: [ :s |
s trimmed
ifNotEmpty: aDescription csvReader
ifEmpty: [ aDescription default ] ]
ifEmpty: [ aDescription undefinedValue ] ]
]
Loading