Add documentation and test for rules option. Fixes #1.