refactor script parsing into class

I use this gem for a side project and wanted to improve some of the more confusing methods. I started with the most problematic one according to code climate. If this is appreciated I will happily clean up some more.