If anyone is interested in this type of functionality, this stuff now exists as a real R package: [ghclass](https://github.com/rundel/ghclass)