delay_henka 0.3.1 → 0.3.2

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: ca7494187ed705ed7b5b5a9a576545c671ab6f59
4
- data.tar.gz: 383b461cf873abf986b0828f2bce245c16c837d9
3
+ metadata.gz: cf9acc4e30db7c0f47c10533484a3de78ff68248
4
+ data.tar.gz: cb0e70029c91a2f67504890493af03aabb6e9872
5
5
  SHA512:
6
- metadata.gz: af5731b55c9ba1d3e994832fb65a8cbbc02ba28769084dbb541008c446caeebf741719e12948bc25720853ea6bd2f9b5d22f0e627e8c1c862fd7f1f1cc4064a2
7
- data.tar.gz: 937efcff97964f245d981548340c326e78417006c03ae6b3d22ce962260b4b6089464f954ed799bf49e6a869586fdf5aa46dff593ce6f06b4d5181d0e965248f
6
+ metadata.gz: 74338132118c97ec2c5e521bfdd9e30081f0ee258295f05e56c9a7820f6a2d0ee81060c23a1c9071e961f224b7ca41fe6b6f398a4acb15179ab260c5d2d1496e
7
+ data.tar.gz: aa320fbe416ede808b658e10e21d5ee2e8c7d875d1d9715091c49fafcf6d5971d72689ed1890c977b283001a816d31221c5df356f4d5f4eaac2f17fdcab0fc92
@@ -2,14 +2,19 @@ module DelayHenka
2
2
  class WhetherSchedule
3
3
 
4
4
  def initialize(record)
5
- @record = record.dup
5
+ @record = record
6
6
  end
7
7
 
8
8
  def make_decision(attribute, new_val)
9
+ evaluate_decision(attribute, new_val).tap do
10
+ @record.restore_attributes
11
+ end
12
+ end
13
+
14
+ def evaluate_decision(attribute, new_val)
9
15
  Keka.run do
10
16
  old_val = record.public_send(attribute)
11
17
  record.public_send("#{attribute}=", new_val)
12
- # can't use xxx_changed? because #dup gives us a new instance
13
18
  Keka.err_if! old_val == record.public_send(attribute)
14
19
  Keka.ok_if! record.valid?
15
20
  Keka.err_if! true, record.errors.full_messages.join(', ')
@@ -1,3 +1,3 @@
1
1
  module DelayHenka
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delay_henka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - zino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-28 00:00:00.000000000 Z
11
+ date: 2019-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails