How to specify minimal Ruby version in gemspec?

I am writing gemspec for a new version of the gem, which will now require Ruby 1.9. Previous versions of the gem were fine with Ruby 1.8, but now it will take 1.9. Is there a way to cause a gem installation for this version of gem with a warning error for users trying to install them on Ruby 1.8?

+46
ruby
Feb 15 2018-11-15T00:
source share
2 answers

From the RubyGems Documentation :

# This gem will work with 1.8.6 or greater... spec.required_ruby_version = '>= 1.8.6' # Only with ruby 2.0.x spec.required_ruby_version = '~> 2.0' 
+70
Feb 15 '11 at 2:48
source share
 gem.required_ruby_version = '1.9.2' 

If you solve your problem :-)

+2
Feb 15 2018-11-15T00:
source share



All Articles