Fix prepended module detection on Ruby 2.0

Ruby's behaviour when prepending a module to a singleton class differs
between 2.0 and 2.1. I wrote a test case to illustrate the differences:
https://gist.github.com/eugeneius/884873965f90092fc50c

On Ruby 2.1, the singleton class always appears in its own ancestors
chain. Prepended modules come before it, and included modules after it.
This is consistent with how the ancestors chain works for normal classes
and modules.

On Ruby 2.0, the singleton class only appears in its own ancestors chain
if a module has been prepended to it. This means we can't find the
prepended modules by just iterating over its ancestors until some
stopping condition. Right now included modules are being incorrectly
classified as prepended modules on Ruby 2.0 - I've included a spec here
capturing the bug that fails on master.

If the singleton class is not in its own ancestors chain, we know there
aren't any prepended modules, so we don't need to check for them. The
existing code works in all other cases.
Merge pull request #771 from eugeneius/fix_prepended_module_detection

Fix prepended module detection on Ruby 2.0