问题描述
在Ruby gem depenedencies的上下文中,〜>
意味着什么? 例如,当打开一个在RubyMine IDE中的遗留项目,我得到这个
消息
项目所需的Gems没有附加:
(〜> 2.0.2),
rspec-expectation(〜> 2.5.0)...
I'在Ruby世界的其他地方看到了这种代字号 - 大于表示法(它不是RubyMine专用的
)。这个操作符的名字不是
的尴尬声音吗? tilde-greater-than ?
它的意思是等于或大于最后一位数字,例如〜> 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依赖关系中的波浪大于(〜>)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!