简体   繁体   中英

Does gem 'mongoid', '~> 4' equal to gem 'mongoid', '>= 4'?

I know what 'mongoid', '~> 3.1.2' mean. But if the version has only one number, what does it mean? Does gem 'mongoid', '~> 4' equal to gem 'mongoid', '>= 4'?

From the documentation :

Most of the version specifiers, like >= 1.0, are self-explanatory. The specifier ~> has a special meaning, best shown by example. ~> 2.0.3 is identical to >= 2.0.3 and < 2.1. ~> 2.1 is identical to >= 2.1 and < 3.0. ~> 2.2.beta will match prerelease versions like 2.2.beta.12.

Read also Ruby's Pessimistic Operator

捎带@Зелёный的答案将文档专门与这个问题联系起来, '~> 4'意味着>= 4< 5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM