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

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

问题描述

~> 在 Ruby gem 依赖的上下文中是什么意思?

例如,在 RubyMine IDE 中打开旧项目时,我得到了这个留言

<上一页>项目所需的宝石未附:arel (~> 2.0.2),rspec-expectation (~> 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 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

这篇关于波浪号大于 (~&gt;) 在 Ruby gem 依赖项中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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