HappyCoder86 HappyCoder86 - 1 year ago 84
Ruby Question

How Can I Specify A Minimum Ruby Version in a Gemfile?

I know that I can specify a Ruby version in a Gemfile like so:

ruby '2.0.0'

However, instead of setting the exact Ruby version, I'd like to be able to specify a minimum Ruby version so that my scripts remain compatible with new version of Ruby.

Answer Source

You could raise an exception instead:

raise 'Ruby should be >2.0' unless RUBY_VERSION.to_f > 2.0
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download