I am new to Ruby and looking for some advice on how to best approach a
I am writing a Facebook application that will rely heavily on the
manipulation of strings. I want to set up a class, allow users to
create objects based on the class, and write it to XML file or a
database. Each entry will be indexed (integer) for lookup and
identification purposes. When I need to load a specific object I will
build it based on the XML data and the defined class.
- Is it possible to define a class and then initialize objects based on
information contained within an XML file?
class Car attr_accessor :model attr_accessor :cost attr_accessor :year end y = Car.new (XML file contains data for model, cost, and year)
I plan to create XML file names based on the index (id) of the
Example: IDs 1000 - 1099 would be in a file named 1000.xml
IDs 1100 - 1199 would be in a file named 1100.xml
There will possibly be tens of thousands of objects (derived from my
class) and each object will contain at least 15 variables
(strings/integers) all written to XML file or mySQL DB. This can
potentially be a large amount of data. Should I examine mySQL or stick
with XML? I want to keep this as simple as possible unless resource
management dictates I take the road less traveled. The speed at which
the data is accessed is most important. I plan to load into memory the
files that are currently in use by a user to speed up the process so
this makes me think that XML would suffice. Hope this makes sense!
Any opinions are welcome.