bx 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +2 -2
  4. data/lib/bx/version.rb +1 -1
  5. data/lib/bx.rb +14 -2
  6. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d9dc9d8753e7e880aa96234a2e6fecdd9fec36993a8933233a3dd12013e43c1
4
- data.tar.gz: 729ac1eabef4e4279f35351fd6cb3237909a1dbefa16005833fa3fe79eb2fa57
3
+ metadata.gz: e72d69ef1a6219e521362318feca893d4f256c7c64ad01944ccc2cd499af8604
4
+ data.tar.gz: 1013e1845727a6862d70b047cebf0adddcf667738d020c184c16e32dfdc33ffc
5
5
  SHA512:
6
- metadata.gz: 687030a43aa65e892f9af6d5d7ed395cd7db3034d17b041fbe0ed440adfdcc353b28ecc08404cb604d5f08bb9251957533fe8cf9d14151c518c72602abf069b8
7
- data.tar.gz: 13df6f1f010571668f55afbedb7feca91f0c396cd9426f1a018c4acb5d993a51b7755567642fb7d3494514dc67754b42e225d4309765b95ed0d1168200a7c0ce
6
+ metadata.gz: 591cd6f3b18e205c87027cdd39710ddef10d097f899d0f5d57c32ad756b0c54cc68d2e8ab95ee769dba950a4bfcd6d4a0d472cfac305235dd1b4704877fb16f1
7
+ data.tar.gz: 9cb8a3ee73d3e503af24d4860e9e2ccfebef08009a6102fc8835f60719c24d40fab93207f2eec783239c297150eb174d2c8fc86d55bf62898e301963d044dd08
data/.gitignore CHANGED
@@ -6,4 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+
10
+ *.gem
9
11
  Gemfile.lock
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.highest_one_bits.each{ ... }
40
+ ids.hi_bits.each{ ... }
41
41
 
42
42
  # enumerate from low to high
43
- ids.lowest_one_bits.each{ ... }
43
+ ids.lo_bits.each{ ... }
44
44
  ```
45
45
 
46
46
  ## Development
data/lib/bx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Bx
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/bx.rb CHANGED
@@ -2,7 +2,7 @@ require "bx/version"
2
2
 
3
3
  class Bx
4
4
  class ::Integer
5
- def highest_one_bits
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 lowest_one_bits
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken