Skip to content

Commit

Permalink
Merge pull request #35 from seandenigris/doc_magritte-parsers
Browse files Browse the repository at this point in the history
[Doc]: Magritte Two-Stage Importer - Class and method comments
  • Loading branch information
seandenigris authored Nov 19, 2023
2 parents 0a2e139 + fedee20 commit 6b305fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions repository/Neo-CSV-Magritte/MACSVTwoStageImporter.class.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"
Sometimes, you just can't fully create your domain objects from CSV in one pass. For example:
- Multiple rows combine into one object (`inject:into:` can be helpful here)
- Multiple cells combine into one object field
To handle such a case, subclass me and, at minimum, override `#convertToDomainObjects:`. See its comment for more info. Implementations of that method often utilize my `#initializeDomainObject:fromRecord:` helper method.
"
Class {
#name : #MACSVTwoStageImporter,
#superclass : #MACSVImporter,
Expand All @@ -20,6 +27,9 @@ MACSVTwoStageImporter >> configureReaderFor: aStream [

{ #category : #accessing }
MACSVTwoStageImporter >> convertToDomainObjects: aCollectionOfDictionaries [
"aCollectionOfDictionaries - the result of a naive processing of CSV
Return - a collection of domain objects"

^ aCollectionOfDictionaries
inject: OrderedCollection new
into: [ :col :rowDict |
Expand Down

0 comments on commit 6b305fb

Please sign in to comment.