Created
February 10, 2010 07:00
-
-
Save shanna/300090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write for and in Ruby 1.9 with 1.8 support in mind. | |
if RUBY_VERSION < '1.9' # or unless RUBY_VERSION >= '1.9' | |
# compatibility backports, monkey patches get required here. | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I don’t know who started the RUBY_VERSION >= ‘1.9′ idiom but they got it backwards. Ruby 1.9 is released, everyone should be writing for (and in) Ruby 1.9 aiming for 1.8 compatibility not the reverse. I understand it may seem like a subtle difference but it is an important one. | |
Drawing this distinction also advantage that when the time comes to drop 1.8 support (and it will just like 1.6 conditions disappeared over time) it will be easy to remove all your 1.8 and older specific code which is now neatly marked as such. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment