[Rubygems-developers] Change in Gem::Requirement.create("~> 1.0.0").satisfied_by? semantics?

Todd Fisher todd.fisher at gmail.com
Mon Nov 26 13:54:54 EST 2007


Hi,
  After upgrading from rubygems 0.9.4 to 0.9.5 I noticed a change in
how the satisfied_by? method compares versions.

Here's a simple example to demonstrate the change in behavior.


0.9.5:

irb(main):001:0>  gem_list =  ["1.0.67943", "1.1.75596"]
=> ["1.0.67943", "1.1.75596"]
irb(main):002:0> req = Gem::Requirement.create("~> 1.0.0")
=> #<Gem::Requirement:0xb7b34720 @requirements=[["~>", #<Gem::Version
"1.0.0">]], @version=nil>
irb(main):003:0> gem_list.select{|v| req.satisfied_by?(Gem::Version.new(v))}
=> ["1.0.67943", "1.1.75596"]


0.9.4:

irb(main):002:0> gem_list =  ["1.0.67943", "1.1.75596"]
=> ["1.0.67943", "1.1.75596"]
irb(main):003:0>  req = Gem::Requirement.create("~> 1.0.0")
=> #<Gem::Version::Requirement:0x7fe34430 @version=nil,
@requirements=[["~>", #<Gem::Version:0x7fe34304 @version="1.0.0">]]>
irb(main):004:0> gem_list.select{|v| req.satisfied_by?(Gem::Version.new(v))}
=> ["1.0.67943"]
irb(main):005:0>


Is this an intended change?

Thanks,
Todd


More information about the Rubygems-developers mailing list