A
Adam Akhtar
although im making a rails app this is more specific to ruby and general
coding.
I want to access several preknown rss feeds, parse and extract the
relevant data and store it into an array. The feeds all have similiar
content but the structure differs. That means my extracting regexps etc
will differ for each feed.
I want to do something like this
items = []
feeds.each do |feed|
clean_up(feed) #squeeze and strip stuff etc
item = parse(feed)
items << item
end
return items
where the code in parse() will vary depedning on the feed.
i know of the template design patter and can implement it but how will i
select the correct parse method for a given feed?
will i have to have a case control structure in the block which will
determine which feed is currently being processed and then apply the
correct parse method? If i had 50 feeds that could be one huge case
structure.. is there a more elegant way?
any tips would be greatly appreciated.
coding.
I want to access several preknown rss feeds, parse and extract the
relevant data and store it into an array. The feeds all have similiar
content but the structure differs. That means my extracting regexps etc
will differ for each feed.
I want to do something like this
items = []
feeds.each do |feed|
clean_up(feed) #squeeze and strip stuff etc
item = parse(feed)
items << item
end
return items
where the code in parse() will vary depedning on the feed.
i know of the template design patter and can implement it but how will i
select the correct parse method for a given feed?
will i have to have a case control structure in the block which will
determine which feed is currently being processed and then apply the
correct parse method? If i had 50 feeds that could be one huge case
structure.. is there a more elegant way?
any tips would be greatly appreciated.