tags:

views:

154

answers:

3

Possible Duplicate:
Meaning of ~> in version requirement

I often stumble upon the ~> operator.

eg.

gem 'httparty', '~> 0.5.2'

What does it mean?

+1  A: 

Are you asking about =~, that is used to match regular expressions.

This should be a comment, not an answer.
AndiDog
It doesn't seem to let me make a comment under any post other than mine
I'll vote you up. Then your reputation exceeds 50 and you'll be able to comment.
steenslag
@beavis - You need 50 rep to comment. So should be able to... now.
Martin Smith
+3  A: 

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/

Vijay Dev
+2  A: 

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.

mipadi