disposable 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/lib/disposable/twin/collection.rb +6 -1
- data/lib/disposable/twin/default.rb +1 -1
- data/lib/disposable/version.rb +1 -1
- data/test/twin/collection_test.rb +14 -2
- 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: f714cb418f7788e8fdfe157660f02e9899a1e457
|
4
|
+
data.tar.gz: d9aff55447493719b64c2b88a5c44d4668b40765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3fb2157bd0afa059d7cf1f964964f3db9c00608a1c67aa7daeb68624b02b4dd10f64048e2ba4b98c9a5a153df7177b6d1fc8c95e22cb42911138f7056fda61
|
7
|
+
data.tar.gz: 97dae2d7decbe780d89697925d23ea6dec33a54c3e69b9f61b71121483323d9c7ff0b1af33405a0d4862d9a595199d90c3d414617bdf76dc53a66eea8c7fb2c5
|
data/CHANGES.md
CHANGED
@@ -14,6 +14,11 @@ module Disposable
|
|
14
14
|
end
|
15
15
|
attr_reader :original # TODO: test me and rethink me.
|
16
16
|
|
17
|
+
# Note that this expects a model, untwinned.
|
18
|
+
def append(model)
|
19
|
+
(self << model).last
|
20
|
+
end
|
21
|
+
|
17
22
|
# Note that this expects a model, untwinned.
|
18
23
|
def <<(model)
|
19
24
|
super(twin = @twinner.(model))
|
@@ -92,4 +97,4 @@ module Disposable
|
|
92
97
|
end # Semantics.
|
93
98
|
end
|
94
99
|
end
|
95
|
-
end
|
100
|
+
end
|
@@ -10,7 +10,7 @@ module Disposable::Twin::Default
|
|
10
10
|
# TODO: introduce Null object in Declarative::Definition#[].
|
11
11
|
# dfn[:default].(self) # dfn#[] should return a Null object here if empty.
|
12
12
|
return unless dfn[:default]
|
13
|
-
dfn[:default].
|
13
|
+
dfn[:default].(self) # TODO: use .()
|
14
14
|
end
|
15
15
|
|
16
16
|
module ClassMethods
|
data/lib/disposable/version.rb
CHANGED
@@ -215,9 +215,21 @@ class CollectionUnitTest < MiniTest::Spec
|
|
215
215
|
collection.insert(0, Model::Album.new).must_be_instance_of Twin::Album
|
216
216
|
end
|
217
217
|
|
218
|
+
# #append(model)
|
219
|
+
it do
|
220
|
+
collection.append(Model::Album.new).must_be_instance_of Twin::Album
|
221
|
+
collection[0].must_be_instance_of Twin::Album
|
222
|
+
|
223
|
+
# allows subsequent calls.
|
224
|
+
collection.append(Model::Album.new)
|
225
|
+
collection[1].must_be_instance_of Twin::Album
|
226
|
+
|
227
|
+
collection.size.must_equal 2
|
228
|
+
end
|
229
|
+
|
218
230
|
# #<<
|
219
231
|
it do
|
220
|
-
collection << Model::Album.new
|
232
|
+
(collection << Model::Album.new).must_be_instance_of Array
|
221
233
|
collection[0].must_be_instance_of Twin::Album
|
222
234
|
end
|
223
|
-
end
|
235
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disposable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|