Refactor of my last PR to remove warnings for ruby >= 1.9
Merge pull request #643 from Shopify/kcode-fix

Refactor of my last PR to remove warnings for ruby >= 1.9