Iteration2 generalization

Functionality is added to generate.mtl and tested using Ruby unit testing.