black_hole_struct 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/black_hole_struct.rb +9 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e6b867238881473e5302a2d846b0f761ede511e
4
- data.tar.gz: b28833bb76c5b7fe5e51a21a94f515cba7eb99e9
3
+ metadata.gz: e81622183c98e979e788f8f2843fc65ade830f05
4
+ data.tar.gz: 1a3bf812813156ba3e86b0b1d38936127fcc4539
5
5
  SHA512:
6
- metadata.gz: 30c0f323a16358dedfbae9eb464a86db214bf39ae7664e89b64f15f5805ff8e163746c68f9830ec764f4ae79564f98eb0440486740939ebba3d4e0a8f425d12b
7
- data.tar.gz: 5ce7b1f60843969f3af2842f66c49162e92e3fad1b8201426ac1f8cd9b71eb0dd23d3cf504ebced1da41e2ad01e8868a4aa96b01c5c8f72f4440fc9f647d12dc
6
+ metadata.gz: b53adc0e9e65c928c51748ac7701d3257f27350a4ea1eba5e9bb10485d8a8d6ad360d4b6a706980df6328ed81faeec0bf59ef7533390aed7120ac4d4a3eae1d4
7
+ data.tar.gz: 7cf886b1d42ab5a470c3d7474b80b2828231b0f802e17457831e70e269cf1ced5afc03bf66cbbe596601ef19d3fb6e2700d4f7aa38990f21cea44418c59995d7
data/README.md CHANGED
@@ -13,13 +13,13 @@
13
13
  Add it to your Gemfile:
14
14
 
15
15
  ```ruby
16
- gem "black-hole-struct"
16
+ gem "black_hole_struct"
17
17
  ```
18
18
 
19
19
  Or install the gem manually:
20
20
 
21
21
  ```sh
22
- $ gem install black-hole-struct
22
+ $ gem install black_hole_struct
23
23
  ```
24
24
 
25
25
  ## Basic Usage
@@ -2,7 +2,7 @@
2
2
  # infinite chaining of attributes or [autovivification](https://en.wikipedia.org/wiki/Autovivification).
3
3
  class BlackHoleStruct
4
4
  # Current version
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
 
7
7
  # BlackHoleStruct can be optionally initialized with a Hash
8
8
  # @param [Hash] hash Initialize with a hash
@@ -49,12 +49,17 @@ class BlackHoleStruct
49
49
  @table[key.to_sym] = self.class.new
50
50
  end
51
51
 
52
- # Calls block once for each key in hsh, passing the key-value pair as parameters.
52
+ # Calls block once for each key passing the key-value pair as parameters.
53
53
  # if no block is given, an Enumerator is returned instead.
54
54
  # @yield [key, value]
55
- def each_pair
56
- @table.each_pair
55
+ def each_pair(&block)
56
+ return @table.each_pair unless block
57
+
58
+ @table.each_pair do |key, value|
59
+ yield key, value
60
+ end
57
61
  end
62
+ alias :each :each_pair
58
63
 
59
64
  # Returns a new hash with self and other_hash merged.
60
65
  # @param [Hash] other_hash
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: black_hole_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bensoussan