shiftable 0.6.1 → 0.7.0

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
  SHA256:
3
- metadata.gz: ae22d0c5730e6bde9ad658ee1b8deddb2ca83e8d09cccc560945faf51c796b6a
4
- data.tar.gz: b8ef6d21e4273b247a4287a31059eb02bed5bafaf3941562ddfc78f798fd139a
3
+ metadata.gz: 5307ad9f6d83499df06dcd5b57745dfeed1522f5701708018c61e5b3a3b6bfba
4
+ data.tar.gz: 5452233e37e38c732340e1f7f825da3c020799b2600b5b692087af44969c2c73
5
5
  SHA512:
6
- metadata.gz: 19ab8c6178402cb18788424023d380672a8d4c7597b432703b79f73900950cf353d8fe85702a0fbd09387f3dd61c4276ba69fe0e9e99499bc77b52d8c9bc3b0b
7
- data.tar.gz: 66d90707da9952a116619e7421127f2c6bad0f4b74558e24ea0da97d7e5670a17960dfabf92ece49ab9cf10bcc60deb9f556f25fc835df656ba9ad1f0f17aa82
6
+ metadata.gz: d7ed429d81143625afb5717143a877b8de5da2729be8519ed87246353051aa26a8f94f9d33765a9b158b7fc6fa21ed35c2017cadf84e26b669c399d61992f627
7
+ data.tar.gz: ba888b498d8da4a6070f29346426b0ea05a23f959ff208400b5c1067394d5d7301850f99dce3cf0a90b712fd57b6dc397d5b871f7d81723901fd0b60d270329f
data/CHANGELOG.md CHANGED
@@ -12,6 +12,11 @@
12
12
  ### Removed
13
13
 
14
14
 
15
+ ## [0.7.0] - 2021-11-15
16
+ ### Changed
17
+
18
+ - Make the `Shifting` Relation available to the `each` wrapper, as a block parameter
19
+
15
20
  ## [0.6.1] - 2021-11-14
16
21
  ### Added
17
22
 
@@ -91,4 +96,16 @@
91
96
 
92
97
  [0.3.0]: https://github.com/pboling/shiftable/releases/tag/v0.3.0
93
98
 
94
- [0.4.0]: https://github.com/pboling/shiftable/releases/tag/v0.4.0
99
+ [0.4.0]: https://github.com/pboling/shiftable/releases/tag/v0.4.0
100
+
101
+ [0.4.1]: https://github.com/pboling/shiftable/releases/tag/v0.4.1
102
+
103
+ [0.5.0]: https://github.com/pboling/shiftable/releases/tag/v0.5.0
104
+
105
+ [0.5.1]: https://github.com/pboling/shiftable/releases/tag/v0.5.1
106
+
107
+ [0.6.0]: https://github.com/pboling/shiftable/releases/tag/v0.6.0
108
+
109
+ [0.6.1]: https://github.com/pboling/shiftable/releases/tag/v0.6.1
110
+
111
+ [0.7.0]: https://github.com/pboling/shiftable/releases/tag/v0.7.0
data/README.md CHANGED
@@ -205,9 +205,9 @@ class Spaceship < ActiveRecord::Base
205
205
  shifting_rel.each { |spaceship| spaceship.federation_changes += 1 }
206
206
  },
207
207
  wrapper: {
208
- each: lambda { |record, &block|
208
+ each: lambda { |rel, record, &block|
209
209
  tresult = record.transaction_wrapper(outside_rescued_errors: ActiveRecord::RecordNotUnique) do
210
- puts "melon #{record.name} honey"
210
+ puts "melon #{record.name} honey #{rel.count}"
211
211
  block.call # does the actual saving!
212
212
  end
213
213
  # NOTE: The value returned by the wrapper will also be returned by the call to `shift_cx`.
@@ -260,9 +260,9 @@ class Spaceship < ActiveRecord::Base
260
260
  shifting_rel.each { |spaceship| spaceship.federation_changes += 1 }
261
261
  },
262
262
  wrapper: {
263
- each: lambda { |record, &block|
263
+ each: lambda { |rel, record, &block|
264
264
  tresult = record.transaction_wrapper(outside_rescued_errors: ActiveRecord::RecordNotUnique) do
265
- puts "melon #{record.name} honey"
265
+ puts "melon #{record.name} honey #{rel.count}"
266
266
  block.call # does the actual saving!
267
267
  end
268
268
  tresult.success?
@@ -373,7 +373,7 @@ the [Pessimistic Version Constraint][pvc] with two digits of precision.
373
373
  For example:
374
374
 
375
375
  ```ruby
376
- spec.add_dependency "shiftable", "~> 0.4"
376
+ spec.add_dependency "shiftable", "~> 0.7"
377
377
  ```
378
378
 
379
379
  ## Contact
@@ -51,7 +51,7 @@ module Shiftable
51
51
  def do_saves
52
52
  if shift_each_wrapper
53
53
  each do |rec|
54
- shift_each_wrapper.call(rec) do
54
+ shift_each_wrapper.call(self, rec) do
55
55
  bang ? rec.save! : rec.save
56
56
  end
57
57
  end
@@ -32,7 +32,7 @@ module Shiftable
32
32
 
33
33
  def do_save
34
34
  if shift_each_wrapper
35
- shift_each_wrapper.call(result) do
35
+ shift_each_wrapper.call(self, result) do
36
36
  bang ? result.save! : result.save
37
37
  end
38
38
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shiftable
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiftable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling