bx 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +2 -2
- data/lib/bx/version.rb +1 -1
- data/lib/bx.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e72d69ef1a6219e521362318feca893d4f256c7c64ad01944ccc2cd499af8604
|
4
|
+
data.tar.gz: 1013e1845727a6862d70b047cebf0adddcf667738d020c184c16e32dfdc33ffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 591cd6f3b18e205c87027cdd39710ddef10d097f899d0f5d57c32ad756b0c54cc68d2e8ab95ee769dba950a4bfcd6d4a0d472cfac305235dd1b4704877fb16f1
|
7
|
+
data.tar.gz: 9cb8a3ee73d3e503af24d4860e9e2ccfebef08009a6102fc8835f60719c24d40fab93207f2eec783239c297150eb174d2c8fc86d55bf62898e301963d044dd08
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -37,10 +37,10 @@ bx['comedy'] = 437
|
|
37
37
|
ids = bx['drama'] & (bx['action'] | bx['comedy'])
|
38
38
|
|
39
39
|
# enumerate from high to low
|
40
|
-
ids.
|
40
|
+
ids.hi_bits.each{ ... }
|
41
41
|
|
42
42
|
# enumerate from low to high
|
43
|
-
ids.
|
43
|
+
ids.lo_bits.each{ ... }
|
44
44
|
```
|
45
45
|
|
46
46
|
## Development
|
data/lib/bx/version.rb
CHANGED
data/lib/bx.rb
CHANGED
@@ -2,7 +2,7 @@ require "bx/version"
|
|
2
2
|
|
3
3
|
class Bx
|
4
4
|
class ::Integer
|
5
|
-
def
|
5
|
+
def hi_bits
|
6
6
|
int = self
|
7
7
|
Enumerator.new do |e|
|
8
8
|
loop do
|
@@ -15,7 +15,7 @@ class Bx
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def lo_bits
|
19
19
|
int = self
|
20
20
|
Enumerator.new do |e|
|
21
21
|
off = 0
|
@@ -42,4 +42,16 @@ class Bx
|
|
42
42
|
def [](key)
|
43
43
|
@hash[key]
|
44
44
|
end
|
45
|
+
|
46
|
+
def keys
|
47
|
+
@hash.keys
|
48
|
+
end
|
49
|
+
|
50
|
+
def values
|
51
|
+
@hash.values
|
52
|
+
end
|
53
|
+
|
54
|
+
def bits_bytes
|
55
|
+
@hash.each_value.sum(&:size)
|
56
|
+
end
|
45
57
|
end
|