I have a text document that has formatted data in it, and I am attempted to determine the best way to parse the data to break it up into hashes that I can then write to my databases. I suppose my issue is determining where to tell Ruby to STOP reading in data to write into the database. The file would be similar to this:
User: Username Phone: Phone number Address: Address Comments: Comments Data1: Data Data2: Data Data3: Data User: Username Phone: Phone number Address: Address Comments: Comments Data1: Data Data2: Data User: Username Phone: Phone number Address: Address Comments: Comments Data1: Data Data2: Data It's not that difficult to chomp the \n and use a split to create a hash in a loop, but how do tell Ruby to start a new database write process if it hits a new "user" key value? Should I write a case statement to check each line for a "user" key and use that line to call a new instance of my database class/method? Is there a faster or more efficient way? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

