Ruby 2.1 compatibility
Created by: marcandre
Ruby 2.1 will return a more consistent ancestor list from singleton classes. This pull request addresses this change. Note that this makes processing easier in 2.1.
Note: I saw some checks on RUBY_VERSION in the code, but I opted to check for the behavior instead.