disposable 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da82ae628d302989838d30e7ee1f493f4ea4ed74
4
- data.tar.gz: d96903d216a97508a08052ca5d33ec17bad2b3d5
3
+ metadata.gz: a849e6821b6f0c16d1da767e93e54b002c601bbe
4
+ data.tar.gz: 0ef377dd5917ab403610f220db4492cb22d664ea
5
5
  SHA512:
6
- metadata.gz: e9b1cc05facbe532e3c46900cc5afc1bc54c17607ee43ff4b87e8270d3a2d4c1f393261acc54a8c1a52adf556cf9f18aa617b1d7f5194ba699284007c78c44fb
7
- data.tar.gz: fa527244dab259db4be2632d17fce579ac4a696dc656400778c272902b61a18973c83bc4673a54b757a58d549ad6aeef552e0b1d31d40ec78e91bfe66626ce58
6
+ metadata.gz: e8716242c4c3d3f7a1b9df458418904d302f5f491cb3f52dfc547bd722e9e256f697142449d06e193ce1e0779dcf6ca2e34a6c457d7e0a8333d0264afdeb46ec
7
+ data.tar.gz: d8b3aa1cbe5a52e48d09c6b3d2e5054aa4a5fea7a73b99966a224fe41d6aaf8ecab81d59a08c283ccb226e5865a36cd89fa30d5510468d54c4c319c5031374b9
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.14
2
+
3
+ * Allow to nil-out nested twins.
4
+
1
5
  # 0.1.13
2
6
 
3
7
  * Allow representable ~> 2.2.
@@ -97,8 +97,9 @@ module Disposable
97
97
  private
98
98
  # assumption: collections are always initialized from Setup since we assume an empty [] for "nil"/uninitialized collections.
99
99
  def write_property(name, value, dfn)
100
- return if dfn[:twin] and value.nil? # TODO: test me (model.composer => nil)
101
- value = dfn.array? ? wrap_collection(dfn, value) : wrap_scalar(dfn, value) if dfn[:twin]
100
+ if dfn[:twin] and value
101
+ value = dfn.array? ? wrap_collection(dfn, value) : wrap_scalar(dfn, value)
102
+ end
102
103
 
103
104
  field_write(name, value)
104
105
  end
@@ -1,3 +1,3 @@
1
1
  module Disposable
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
@@ -74,6 +74,17 @@ class TwinTest < MiniTest::Spec
74
74
  song.title.must_equal "Broken"
75
75
  end
76
76
 
77
+ describe "deleting" do
78
+ it "allows overwriting nested twin with nil" do
79
+ album = Model::Album.new(1, "Uncertain Terms", [], artist=Model::Artist.new("Greg Howe"))
80
+ twin = Twin::Album.new(album)
81
+ twin.artist.id.must_equal "Greg Howe"
82
+
83
+ twin.artist = nil
84
+ twin.artist.must_equal nil
85
+ end
86
+ end
87
+
77
88
  # setters for twin properties return the twin, not the model
78
89
  # it do
79
90
  # result = twin.album = album
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.1.13
4
+ version: 0.1.14
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-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber