delay_henka 0.1.1 → 0.2.1

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: bca14143148ad51e030522dec501a8fc2e7d57f8
4
- data.tar.gz: f93a43c02a1ece35b9496c2b88ad79b4b65f03fc
3
+ metadata.gz: a0d90483609b5a69d7f76de25d0976eb11c69d78
4
+ data.tar.gz: '09c3b7f7f8091320a23878548af80f89ca76fcdf'
5
5
  SHA512:
6
- metadata.gz: e3a844e35ed8d8d70daa68149c03a0ed8690465c1f79206a79de0ac25b71a7e5aa0013040e5b0f9a37766b2f94eb8c09538c0fd2c046b23dc17ee8513df0955f
7
- data.tar.gz: bafbc29ea3f141d25e4d9e92c29f8eeeeb121f7cc221171de91f84f9040a4d02d8ea5719f668b0cb8954457fc2b6b832921d96220531deee03e333c624ea21d7
6
+ metadata.gz: 945923c8797038814cb1c9ceb37f8d9da2a554a85060a79abfcbc5013e319868b69d134cfdeb64b0e3b57e195521bc2668135460c020b148a4b165d54f7c7c90
7
+ data.tar.gz: f1a9925b8c68c8f0a548e88514fc9deb12e32e7f3f81233ed0840efb43ea10e96423e3441e15644dce70ce5da3928bd0295403190d09052883e8da9e507cbcc5
@@ -19,8 +19,9 @@ module DelayHenka
19
19
  def self.schedule(record:, changes:, by_id:)
20
20
  changes.each do |attribute, new_val|
21
21
  old_val = record.public_send(attribute)
22
- next if old_val == new_val
23
- create!(changeable: record, submitted_by_id: by_id, attribute_name: attribute, old_value: old_val, new_value: new_val)
22
+ cleaned_new_val = cleanup_val(new_val)
23
+ next if old_val == cleaned_new_val
24
+ create!(changeable: record, submitted_by_id: by_id, attribute_name: attribute, old_value: old_val, new_value: cleaned_new_val)
24
25
  end
25
26
  end
26
27
 
@@ -38,6 +39,11 @@ module DelayHenka
38
39
 
39
40
  private
40
41
 
42
+ def self.cleanup_val(val)
43
+ return val unless val.respond_to?(:strip)
44
+ val.strip == '' ? nil : val
45
+ end
46
+
41
47
  def set_initial_state
42
48
  self.state ||= STATES[:STAGED]
43
49
  end
@@ -1,3 +1,3 @@
1
1
  module DelayHenka
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delay_henka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zino