thanks Ron, I hadn’t thought about class variables.
<br/><br/>sincerely,
<br/><br/>Joe.
<br/><br/><div class='shrinkable-quote'><br/>> On Jun 10, 2016, at 12:17 PM, Ron Teitelbaum [via Smalltalk] <<a href="/user/SendEmail.jtp?type=node&node=4900705&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>> wrote:
<br/>>
<br/>> Hi Joe,
<br/>>
<br/>> I'm not sure in what context you mean. Why wouldn't you run this in the
<br/>> #initialize method?
<br/>>
<br/>> JoeAccountingParser class>>configure
<br/>> InPath := '/Users/jja/Desktop/accountingfiles/'.
<br/>> OutPath := '/Users/jja/Desktop/accountingfiles processed/'.
<br/>>
<br/>> JoeAccountingParser >>initialize
<br/>> self class configure.
<br/>> fileParser := FileParser new.
<br/>> fileParser inPath: self class InPath.
<br/>> fileParser outPath: self class OutPath.
<br/>>
<br/>> JoeAccountingParser class >> process: aFile
<br/>> ^(self new) process: aFile; yourself.
<br/>>         
<br/>>
<br/>> JoeAccountingParser process: aFile
<br/>> fileParser readThis: aFile.
<br/>> fileParser process.
<br/>> fileParser write.
<br/>>
<br/>> This is a bit refactored and it uses the configure method I recommend to you
<br/>> earlier. This configure method could be anything including a method to read
<br/>> an external file for details.
<br/>>
<br/>> Solutions like a factory method pattern come to mind if you don't want to
<br/>> use #initialize.
<br/>>
<br/>> JoeAccountingParser class >> process: aFile from: inPath to: outPath
<br/>>
<br/>> There is also Behavior #startUp and #shutDown on the class side.
<br/>>
<br/>> See Smalltalk #addToStartUpList: #addToShutDownList:
<br/>>
<br/>> These fire when an image is started or shutdown.
<br/>>
<br/>> I think a bit more explanation of what problem you are having is needed.
<br/>>
<br/>> All the best,
<br/>>
<br/>> Ron Teitelbaum
<br/>>
<br/>>
<br/>>
<br/>> > From: Joseph Alotta
<br/>> > Sent: Friday, June 10, 2016 12:23 PM
<br/>> >
<br/>> > Greetings,
<br/>> >
<br/>> > My object needs to have some variables set before it can run the
<br/>> initialize
<br/>>
<br/>> > method and also it needs to have run an exit method.
<br/>> >
<br/>> > f := FileParser new.
<br/>> > f inPath: '/Users/jja/Desktop/accountingfiles/'.
<br/>> > f readThis: 'rei mastercard.csv'.
<br/>> > f process
<br/>> > f outPath: '/Users/jja/Desktop/accountingfiles processed/'.
<br/>> > f write.
<br/>> >
<br/>> >
<br/>> > Is there a better way to do this?
<br/>> >
<br/>> > Sincerely,
<br/>> >
<br/>> > Joe.
<br/>> >
<br/>> >
<br/>> > _______________________________________________
<br/>> > Beginners mailing list
<br/>> > [hidden email]
<br/>> > <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br/>>
<br/>> _______________________________________________
<br/>> Beginners mailing list
<br/>> [hidden email]
<br/>> <a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_top" rel="nofollow" link="external">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br/>>
<br/>>
<br/>> If you reply to this email, your message will be added to the discussion below:
<br/>> <a href="http://forum.world.st/set-variables-before-initialize-and-write-out-files-before-exit-tp4900437p4900450.html" target="_top" rel="nofollow" link="external">http://forum.world.st/set-variables-before-initialize-and-write-out-files-before-exit-tp4900437p4900450.html</a><br/>> To start a new topic under Squeak - Beginners, email <a href="/user/SendEmail.jtp?type=node&node=4900705&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>
<br/>> To unsubscribe from Squeak - Beginners, click here.
<br/>> NAML
</div><br/>
        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/set-variables-before-initialize-and-write-out-files-before-exit-tp4900437p4900705.html">Re: set variables before initialize and write out files        before exit</a><br/>
Sent from the <a href="http://forum.world.st/Squeak-Beginners-f107673.html">Squeak - Beginners mailing list archive</a> at Nabble.com.<br/>