Specify minimum and maximum Ruby version needed

What is the best way to assure the minimum Ruby language version to be
used? I came up with the following solution (example:

BEGIN {
raise “Incorrect Ruby version used” unless
RUBY_VERSION >= “1.8.7” && RUBY_VERSION < “2”
}

Is there a more natural way to achieve this?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs