collapsium 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/lib/collapsium/indifferent_access.rb +4 -1
- data/lib/collapsium/version.rb +1 -1
- data/spec/indifferent_access_spec.rb +13 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac48359cda7fa845f6ee9bf88db8da16b190899d
|
4
|
+
data.tar.gz: c7c5c3c9c28978e1c85d397ea6a731bdaf911042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eebf8ce4bcbab3920f3809ccb793e33da5b4343ec14c8e2c5b8edb7309f80a06e8b3c6c21dcad144484148c2adf56d19af21fbf9e3987ff3346ae95ec6d95891
|
7
|
+
data.tar.gz: da064743e896e5fe6505d2fc9dd5213adec4964dc93871b97a74592da0e0569df87590e3d75bde56ae532b1b7c7a1c5c7aeb309039998bd706deea7ff3f1730b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -71,7 +71,10 @@ module Collapsium
|
|
71
71
|
return sorted
|
72
72
|
end
|
73
73
|
|
74
|
-
READ_METHODS =
|
74
|
+
READ_METHODS = (
|
75
|
+
::Collapsium::Support::HashMethods::KEYED_READ_METHODS \
|
76
|
+
+ ::Collapsium::Support::HashMethods::KEYED_WRITE_METHODS
|
77
|
+
).freeze
|
75
78
|
|
76
79
|
INDIFFERENT_ACCESS_READER = proc do |wrapped_method, *args, &block|
|
77
80
|
# Bail out early if the receiver is not a Hash. Do the same if we have
|
data/lib/collapsium/version.rb
CHANGED
@@ -92,6 +92,19 @@ describe ::Collapsium::IndifferentAccess do
|
|
92
92
|
expect(result).to be_truthy
|
93
93
|
end
|
94
94
|
|
95
|
+
it "also works for write access" do
|
96
|
+
test = {
|
97
|
+
"foo" => 123
|
98
|
+
}
|
99
|
+
test.extend(::Collapsium::IndifferentAccess)
|
100
|
+
|
101
|
+
expect { test[:foo] = 42 }.not_to raise_error
|
102
|
+
expect(test["foo"]).to eql 42
|
103
|
+
|
104
|
+
expect { test.delete(:foo) }.not_to raise_error
|
105
|
+
expect(test.empty?).to be_truthy
|
106
|
+
end
|
107
|
+
|
95
108
|
context IncludedIndifferentHash do
|
96
109
|
let(:tester) { IncludedIndifferentHash.new }
|
97
110
|
|