How does the pessimistic version operator (~>) in Ruby handle alpha/beta versions?

人走茶凉 提交于 2020-01-14 01:42:20

问题


I understand how the "pessimistic version operator" works with normal, numeric version specifiers (see also this question), but how does it process alpha or beta versions such as '~> 2.0.0.alpha.4'? Will this match future beta and stable versions?


回答1:


I ran a couple of quick tests in irb with the following pattern:

Gem::Requirement.new("~> 2.0.0.alpha.4").satisfied_by?(Gem::Version.new("[version.string.to.test]"))

For instance:

irb(main):001:0> Gem::Requirement.new("~> 2.0.0.alpha.4").satisfied_by?(Gem::Version.new("2.0.1"))
=> true

These tests show that "~> 2.0.0.alpha.4" matches version numbers up to, but not including, "2.1.0".



来源:https://stackoverflow.com/questions/19206922/how-does-the-pessimistic-version-operator-in-ruby-handle-alpha-beta-version

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!