dumb_numb_set 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/dumb_numb_set.rb +12 -0
- metadata +12 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c68fe778239eb88cbd137546f41cba127e0fc62a
|
4
|
+
data.tar.gz: 52b21f8a6f2e01a3c9afe342169ebeff38c3e14b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 066a0250c368106bf7276884986072abb1001e281f7f5931c74decbdde92045257d498412c996edfc6fb6b3f95c58b8e2303eac09e2bc27e59bbc7ac79852fc2
|
7
|
+
data.tar.gz: dc5934a3b2ceea49368a11597543e61a605eeeb3e0c1a72b94f1fe6f86688ebbbb9781b1718e484e991ea8bb02222154795c9a7728aa7ce553be0921a8f36acf
|
data/lib/dumb_numb_set.rb
CHANGED
@@ -112,6 +112,18 @@ class DumbNumbSet
|
|
112
112
|
def size
|
113
113
|
@bitsets.length
|
114
114
|
end
|
115
|
+
|
116
|
+
def each
|
117
|
+
@bitsets.each do |index, bitset|
|
118
|
+
offset = index * @div
|
119
|
+
(0..@div-1).each do |bit|
|
120
|
+
if bitset & (1 << bit) != 0
|
121
|
+
yield offset + bit
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
include Enumerable
|
115
127
|
end
|
116
128
|
|
117
129
|
# Custom marshal technique if MessagePack is available. Saves some bytes,
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumb_numb_set
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.3
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Justin Collins
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-08-12 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: |
|
15
14
|
Ever needed to compactly store and query a set of mostly consecutive,
|
16
15
|
non-negative integers? Probably not, but if you do this library may work for
|
17
16
|
you. It's just about as fast as a Set and a lot smaller for numbers that stay
|
18
17
|
close together.
|
19
|
-
email:
|
18
|
+
email:
|
20
19
|
executables: []
|
21
20
|
extensions: []
|
22
21
|
extra_rdoc_files: []
|
@@ -25,26 +24,25 @@ files:
|
|
25
24
|
homepage: https://github.com/presidentbeef/dumb-numb-set
|
26
25
|
licenses:
|
27
26
|
- MIT
|
28
|
-
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
29
|
rdoc_options: []
|
30
30
|
require_paths:
|
31
31
|
- lib
|
32
32
|
required_ruby_version: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- -
|
34
|
+
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
36
|
version: '0'
|
37
|
-
none: false
|
38
37
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
38
|
requirements:
|
40
|
-
- -
|
39
|
+
- - ">="
|
41
40
|
- !ruby/object:Gem::Version
|
42
41
|
version: '0'
|
43
|
-
none: false
|
44
42
|
requirements: []
|
45
|
-
rubyforge_project:
|
46
|
-
rubygems_version:
|
47
|
-
signing_key:
|
48
|
-
specification_version:
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.2.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
49
47
|
summary: A compact data structure for mostly consecutive, non-negative integers.
|
50
48
|
test_files: []
|