closed_struct 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +2 -0
- data/lib/closed_struct.rb +8 -0
- data/lib/closed_struct/version.rb +1 -1
- data/spec/closed_struct_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28546d4be83e1624fef9ec85a238cfd3d6debdfe
|
4
|
+
data.tar.gz: eac66537ba3862b2abeb1dca394ec160c1ac2563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6eb380739825b3df92abe99441042d364c12a25f5b437f0f63d1a5a61d8dfe518018dde7e90801a52c5f1cec31ce384280167d8c8885b81670f37a59ee6c597
|
7
|
+
data.tar.gz: 70821c0e52ddd86aa837757aa876a0faa6c08b881ec3b65e0656641c61595e463cfae68016083f3e6abecb0dc47714c4e1366ae1f51ac7aebf23d519810c07ca
|
data/CHANGELOG
CHANGED
data/lib/closed_struct.rb
CHANGED
data/spec/closed_struct_spec.rb
CHANGED
@@ -60,4 +60,25 @@ describe ClosedStruct do
|
|
60
60
|
expect(ClosedStruct.new(:a => :b).empty?).to be_falsey
|
61
61
|
end
|
62
62
|
|
63
|
+
describe "#each_pair" do
|
64
|
+
it "does not yield when empty" do
|
65
|
+
object = ClosedStruct.new({})
|
66
|
+
expect { |b| object.each_pair(&b) }.to_not yield_control
|
67
|
+
end
|
68
|
+
|
69
|
+
it "yields a key-value pair for a key in the hash" do
|
70
|
+
object = ClosedStruct.new(:a => :b)
|
71
|
+
expect { |b| object.each_pair(&b) }.to yield_with_args(:a, :b)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "yields a key-value pair for each key in the hash" do
|
75
|
+
object = ClosedStruct.new(:a => :b, :c => :d)
|
76
|
+
expect { |b| object.each_pair(&b) }.to yield_successive_args([:a, :b], [:c, :d])
|
77
|
+
end
|
78
|
+
|
79
|
+
it "returns an enumerator if a block is not provided" do
|
80
|
+
expect(ClosedStruct.new(:a => :b).each_pair).to contain_exactly([:a, :b])
|
81
|
+
expect(ClosedStruct.new({}).each_pair).to_not include(anything)
|
82
|
+
end
|
83
|
+
end
|
63
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closed_struct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Obrok
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|