This is really good stuff. I am going to get into nitty gritty to give you some items you could tweak:
- Your
Parsablemodule is statically referencing two instance variables that are being created outside this module:@nokogiri_documentand@file. That is a no-no. You want your module to be written in such a way that it needs to know nothing about the rest of your code. Thus, a better way would be to pass the nokogiri document and the file to the module as arguments. As in other words, yourParsablemodule should be written in such a way that, if the names of these two instance variables were changed, there would be no need to change any of the code in yourParsablemodule. - The
map_with_indexon line 5 in yourParsablemodule is sweet. Nice work iterating over the DOM like this and delivering an array ofcommentobjects to yourpostinitialize method. - Heads up: Your
to_smethod on yourpostclass only prints the state of the ```comment