Ruby gem依赖关系中的波浪大于(〜>)是什么意思? [英] What does tilde-greater-than (~>) mean in Ruby gem dependencies?

查看:233
本文介绍了Ruby gem依赖关系中的波浪大于(〜>)是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 this message

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 not specific to RubyMine). Does this operator have a name other than the awkward-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 would mean "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依赖关系中的波浪大于(〜&gt;)是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆