disposable 0.1.2 → 0.1.3

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: 344f81de5499edef8813bf4f4c20d4b39e8b351f
4
- data.tar.gz: 1e2a2305010b56e2f6a285a704206a54d6f6fb0e
3
+ metadata.gz: 8c253349d4d314ee180fd275bf708c5d1dc3fcc2
4
+ data.tar.gz: 76b13c0d6262f330cc183c2498ab60f8cb0bf127
5
5
  SHA512:
6
- metadata.gz: 0ae1f63242b61ca78b801762a36caeff71c292e83a146478e60916b5fac3a072879296dcee95c7dbe06a3b146a7f533613fd32bb9a4deb7ff7ceb287535163d1
7
- data.tar.gz: e9d20cb50187ead62ff6a58ed89e4598e74168ab7d49a9edf857d0d46e683c521e616e448a76b66fdc341c41217067bd3b7b1b0b9c954f2af5d273a35d47e974
6
+ metadata.gz: 5d5f2a357dac409f5d1c89dd20a2dc66d6de8526bc27f62a9b7b290291d8ff2d7073cc3c06b74722ceba3be6ed9289de47ed1ac08b63ea81b50ef620999b7927
7
+ data.tar.gz: 8d21e16cf85e61cec5cc2591386b1879642588b5afe48d41f490f7880b1467f3259004155407a5d582d00c3c79ff86990b0abd270489e9918db200b936665c5a
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.1.3
2
+
3
+ * Fix `Composition#save`, it now returns true only if all models could be saved.
4
+ * Introduce `Callback::Group::clone`.
5
+
1
6
  # 0.1.2
2
7
 
3
8
  * Fix `Changed` which does not use the public reader to compare anymore, but the private `field_read`.
data/README.md CHANGED
@@ -279,7 +279,7 @@ Compositions of objects can be mapped, too.
279
279
 
280
280
  ```ruby
281
281
  class AlbumTwin < Disposable::Twin
282
- feature Composition
282
+ include Composition
283
283
 
284
284
  property :id, on: :album
285
285
  property :title, on: :album
data/database.sqlite3 CHANGED
Binary file
@@ -25,6 +25,10 @@ module Disposable::Callback
25
25
  end
26
26
  end
27
27
 
28
+ def self.clone
29
+ Class.new(self)
30
+ end
31
+
28
32
  def self.feature(*args)
29
33
  end
30
34
 
@@ -48,7 +48,9 @@ module Disposable
48
48
 
49
49
  private
50
50
  def save_model
51
- mapper.each(&:save) # goes through all models in Composition.
51
+ res = true
52
+ mapper.each { |twin| res &= twin.save } # goes through all models in Composition.
53
+ res
52
54
  end
53
55
  end
54
56
  end
@@ -1,3 +1,3 @@
1
1
  module Disposable
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -219,4 +219,15 @@ class CallbackGroupInheritanceTest < MiniTest::Spec
219
219
  RemovingInheritGroup.representer_class.representable_attrs.get(RemovingInheritGroup.hooks[0][1]).representer_module.hooks.to_s.must_equal "[[:on_add, [:reset_song!]]]"
220
220
  RemovingInheritGroup.representer_class.representable_attrs.get(RemovingInheritGroup.hooks[2][1]).representer_module.hooks.to_s.must_equal "[[:on_change, [:sing!]]]"
221
221
  end
222
+
223
+ # Group::clone
224
+ ClonedGroup = Group.clone
225
+ ClonedGroup.class_eval do
226
+ remove! :on_change, :change!
227
+ end
228
+
229
+ it do
230
+ Group.hooks.size.must_equal 4
231
+ ClonedGroup.hooks.size.must_equal 3
232
+ end
222
233
  end
@@ -43,7 +43,8 @@ class TwinCompositionTest < MiniTest::Spec
43
43
  requester.name.must_equal "Greg Howe"
44
44
 
45
45
 
46
- request.save
46
+ res = request.save
47
+ res.must_equal true
47
48
 
48
49
  # make sure models got synced and saved.
49
50
  song.id.must_equal 2
@@ -73,4 +74,11 @@ class TwinCompositionTest < MiniTest::Spec
73
74
 
74
75
  nested_hash.must_equal(:song=>{"title"=>"Tease", "id"=>2}, :requester=>{"name"=>"Wooten", "id"=>1, "captcha"=>"Awesome!"})
75
76
  end
77
+
78
+ # save with one unsaveable model.
79
+ #save returns result.
80
+ it do
81
+ song.instance_eval { def save; false; end }
82
+ request.save.must_equal false
83
+ end
76
84
  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.1.2
4
+ version: 0.1.3
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-06-27 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uber