------_ extPart_001_01C62B75.53C5DB3A
Content-Type: text/plain
Hello,
I am fairly new to ruby and need some help
I am structuring my code using classes.
The application I work on requires input data. This data may require all or
some of the classes I create. Instead of having a section in the main code
creating all classes I would like to create only those classes that I need
while reading the data. However I do not know how to do that. Below is the
outline of my code.
Any suggestions
class ReadFileFactory
# handles calling the right class to for reading the data
# from database, from CSV-file, etc.
... code goes here .....
end
class CSVReadFile( externalClass, nameID )
# handles reading data using a csv-file and assigning it to the appropriate
Hash
... code goes here .....
case signal
when nameID
externalClass.getLine(tempStore)
when ....
end
class AddSubscriber
# handles adding a subscriber
... code goes here .....
end
# main program
# Initialize I don't like that
class1 lass1.new;
class2 lass2.new; #etc
test ReadFileFactory.start_csv_readfile("sample.csv")
test.processingFile( class1 )
# I rather would have something like that
ReadFileFactory.start_csv_readfile("sample.csv") will return only the
classes I need.
------_ extPart_001_01C62B75.53C5DB3A--