Processing a file of structured data of unknown origin

I have a file with data structured in this way...

So basically it's

Country   Region     Resort       url       url       url       url     Resort       url       url

Country   Region     Resort       url     Resort       url       url

etc, the data is clearly structured and yaml like - but it's not yaml I feel. Anyway - I just wish to create active record objects out of it - how would I go about processing that file - tips greatly appreciated?

I don't have any specific code for you, but this is how I would attack it:

1. Split by lines. 2. Loop through the lines, using the number of spaces at the beginning of the line as a "level counter". 3. Whenever the level goes up or down, change to a new model -- Country, Region, Resort, Url. When the level goes up or down, keep track of the preceding model object at the next lower level, as that is your parent. 4. At each line, create a new object of the current model, adding the parent reference as appropriate.