What does ~> mean in a gem file

Ruby on-Rails

Ruby on-Rails Problem Overview


In the gem file for https://github.com/justinfrench/formtastic they have:

 gem 'formtastic', '~> 2.0.0'

What does the > mean. It actually gives me the error "Could not find gem 'formtastic (> 2.0.0, runtime)' in any of the gem sources."

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

It's a confusing operand, but it limits versions to a subset of the possible versions. So ~> 2.0.0 means ">= 2.0.0 and < 2.1.0" in version numbers.

1.2.3 seems to be the latest version of Formtasic, that's why you're getting this error message.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLogan BaileyView Question on Stackoverflow
Solution 1 - Ruby on-RailsPan ThomakosView Answer on Stackoverflow