bloom_filter 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bloom_filter.gemspec +1 -1
- data/lib/bloom_filter/bit_vector.rb +2 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
data/bloom_filter.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class BloomFilter
|
2
2
|
class BitVector
|
3
3
|
attr_reader :size
|
4
|
+
IS_RUBY_19 = RUBY_VERSION >= '1.9'
|
4
5
|
|
5
6
|
def initialize(bits, from_str = nil)
|
6
7
|
@bytes = Array.new((bits.to_f / 8).ceil, 0)
|
@@ -8,7 +9,7 @@ class BloomFilter
|
|
8
9
|
|
9
10
|
if from_str
|
10
11
|
from_str.size.times do |i|
|
11
|
-
@bytes[i] = from_str[i].ord
|
12
|
+
@bytes[i] = IS_RUBY_19 ? from_str[i].ord : from_str[i]
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|