Ruby-on-rails ~> 在 gem 文件中是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5101591/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:29:47  来源:igfitidea点击:

What does ~> mean in a gem file

ruby-on-rails

提问by Logan Bailey

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

https://github.com/justinfrench/formtastic的 gem 文件中,他们有:

 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."

~> 是什么意思。它实际上给了我错误“在任何 gem 源中找不到 gem 'formtastic (~> 2.0.0, runtime)'。”

采纳答案by Pan Thomakos

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

这是一个令人困惑的操作数,但它将版本限制为可能版本的一个子集。所以~> 2.0.0意味着 ">= 2.0.0 and < 2.1.0" 在版本号中。

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

1.2.3 似乎是 Formtasic 的最新版本,这就是您收到此错误消息的原因。