Permalink
Browse files

Kick out the VersionSpace#includes? method, less magic.

  • Loading branch information...
1 parent cde2f6c commit 3c70309afdd987febcf4a89ccd834d97c50a3ab7 @arthurschreiber committed Apr 13, 2011
Showing with 1 addition and 17 deletions.
  1. +1 −5 ruby/lib/version_space.rb
  2. +0 −12 ruby/spec/version_space_spec.rb
@@ -66,12 +66,8 @@ def negative_example(example)
@g.reject! { |g| @s.any? { |s| more_general?(s, g) }}
end
- def includes?(a, b)
- a == b || a == :*
- end
-
def more_general?(hyp1, hyp2)
- hyp1.zip(hyp2).all?(&method(:includes?))
+ hyp1.zip(hyp2).all? { |a, b| a == b || a == :* }
end
def generalize(hyp1, hyp2)
@@ -125,18 +125,6 @@
]
@vs.s.should == [[:*, "VW", "90-120", "< 2 l", "< 180", "Diesel", "< 6 l", "Minivan", "8", :*, :*]]
end
-
- describe "#includes?" do
- it "returns true if both parameters are equal" do
- @vs.includes?("a", "a").should be_true
- @vs.includes?("a", "b").should be_false
- end
-
- it "returns true if the first parameter is more general" do
- @vs.includes?(:*, "a").should be_true
- @vs.includes?(:*, "b").should be_true
- end
- end
describe "#more_general?" do
it "should return true if the first list is equal to the second" do

0 comments on commit 3c70309

Please sign in to comment.