Skip to content

Instantly share code, notes, and snippets.

@shanna
Created February 10, 2010 07:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanna/300090 to your computer and use it in GitHub Desktop.
Save shanna/300090 to your computer and use it in GitHub Desktop.
# 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
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