Permalink
Browse files

Deserialize Bloomfilter::Native properly.

  • Loading branch information...
1 parent 846a687 commit 3ccb85ff440604c301b0348137550e9cb0d90c40 @twhaples twhaples committed May 8, 2012
Showing with 8 additions and 6 deletions.
  1. +2 −2 lib/bloomfilter/native.rb
  2. +6 −4 spec/native_spec.rb
View
4 lib/bloomfilter/native.rb
@@ -70,8 +70,8 @@ def bitmap
def marshal_load(ary)
opts, bitmap = *ary
- @bf = Native.new(opts)
- @bf.bf.load(bitmap) if !bitmap.nil?
+ initialize(opts)
+ @bf.load(bitmap) if !bitmap.nil?
end
def marshal_dump
View
10 spec/native_spec.rb
@@ -133,10 +133,12 @@
bf.insert('bar')
bf.save('bf.out')
- bf = Native.load('bf.out')
- bf.include?('foo').should be_true
- bf.include?('bar').should be_true
- bf.include?('baz').should be_false
+ bf2 = Native.load('bf.out')
+ bf2.include?('foo').should be_true
+ bf2.include?('bar').should be_true
+ bf2.include?('baz').should be_false
+
+ bf.send(:same_parameters?, bf2).should be_true
end
end
end

0 comments on commit 3ccb85f

Please sign in to comment.