问题描述
~>
在 Ruby gem 依赖的上下文中是什么意思?
例如,在 RubyMine IDE 中打开遗留项目时,我得到这个留言
项目所需的宝石不附:雷尔 (~> 2.0.2),rspec 期望 (~> 2.5.0)...我在 Ruby 世界的其他地方见过这种波浪号大于符号(它不是特定于 RubyMine).这个操作员是否有一个名字而不是听起来很尴尬波浪号大于?
表示等于或大于最后一位数字",例如~>2.3 表示等于 2.3 或大于 2.3,但小于 3.0",而 ~>2.3.0
会表示等于 2.3.0 或大于 2.3.0,但小于 2.4.0".
您可以将其发音为大约大于".
What does ~>
mean in the context of Ruby gem depenedencies?
For example, when opening a legacy project in the RubyMine IDE, I get thismessage
Gems required for project are not attached: arel (~> 2.0.2), rspec-expectation (~> 2.5.0)...
I've seen this tilde-greater-than notation elsewhere in the Ruby world (it's notspecific to RubyMine). Does this operator have a name other than theawkward-sounding tilde-greater-than?
It means "equal to or greater than in the last digit", so e.g. ~> 2.3
means"equal to 2.3 or greater than 2.3, but less than 3.0", while ~> 2.3.0
wouldmean "equal to 2.3.0 or greater than 2.3.0, but less than 2.4.0".
You can pronounce it as "approximately greater than".
§ Pessimistic version constraint
这篇关于代字号大于 (~>) 在 Ruby gem 依赖项中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!