做什么〜>在gemspec依赖中意味着什么?

时间:2012-09-08 09:35:23

标签: ruby gem bundler

  

可能重复:
  Meaning of tilde-greater-than (~>) in version requirement?

我在gemspecs中看到了类似的东西:

s.add_dependency 'some_gem', '~> 1.5.0'

什么〜>意思?

1 个答案:

答案 0 :(得分:6)

来自gembundler

The specifier ~> has a special meaning, best shown by example. ~> 2.0.3 is 
identical to >= 2.0.3 and < 2.1. ~> 2.1 is identical to >= 2.1 and 
< 3.0. ~> 2.2.beta will match prerelease versions like 2.2.beta.12.