Hello,
I have a feed reader written in Rails (the logic is bit complex as I am scraping some data) and I am trying to generalize the methods. Here is my current structure -
Class Gizmodo
def update
update logic
end
end
Class Wired
def update
update logic
end
end
Now I am thinking of structure like this
Class Story
def update(feed_name)
logic for feed - stored somewhere
end
end
I am thinking of storing the methods in table as string and then use class_eval(string) to generate the code. I believe this is ineffective. What are the other ways of storing code?
P.S -
- I am using tables, because in future I want to add functionality of adding feeds and their logic.
- Once a feed is added, the logic will stay permanent. Is there a way of hard coding the methods, like writing the methods to module file?