Skip to content

Commit

Permalink
Merge pull request #44 from seandenigris/enh-ma-add-field-no-default-set
Browse files Browse the repository at this point in the history
[Enh]: Magritte Field Adding - Don't Set Default for Nils
  • Loading branch information
seandenigris authored Oct 21, 2023
2 parents 0ba1afb + 63ee309 commit 704e459
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
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 ] ]
]

0 comments on commit 704e459

Please sign in to comment.