use ruby behavior to test for feature instead of RUBY_VERSION

Previous code checked part of the RUBY_VERSION constant and no longer worked properly in 2.x
This change will check the behavior of strings before applying the change, which protects against
numbering changes in versions.