What does the ~> operator mean? [duplicate]
Possibl开发者_StackOverflow中文版e Duplicate:
Meaning of ~> in version requirement
I often stumble upon the ~> operator.
eg.
gem 'httparty', '~> 0.5.2'
What does it mean?
It's called a pessimistic version constraint. It matches a gem version by dropping the last digit and comparing equality. For example, ~> 0.5.2
would match version 0.5.2 or 0.5.3, but not 0.5 or 0.6. It's basically equivalent to a constraint of >= 0.5.2, < 0.6
.
It means that any version >= 0.5.2 and < 0.6.0
Yehuda Katz recently wrote about this - http://yehudakatz.com/2010/08/21/using-considered-harmful-or-whats-wrong-with/
精彩评论