[TASK] Document the source code using YARD.

Add more documentation to the source code and replace RDoc with YARD:
https://github.com/lsegal/yard

This change also adds a "yard" rake task.