Using a module instead of a class
Sometimes I write code in a class which I feel might be better written in a module. I don’t initialize the class and have a hard time imagining it as a object. It mostly houses procedural code.
I found this SO link which gives a good answer: http://stackoverflow.com/questions/2671545/when-to-use-a-module-and-when-to-use-a-class
also this might be useful : http://matt.aimonetti.net/posts/2012/07/30/ruby-class-module-mixins/
Advertisements
Leave a Comment