Added compatibility with ruby 1.8.7

Can you add this pull request to support ruby 1.8.7?

Thank you!