autopopulater 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5f6e399d8be2ea9b66e2e209b31687209ea5d6788542c2748316613436e7fa8
4
- data.tar.gz: 1311add23d473e713f41872b29dff88427fd6b9d90b18b9a3c0f64922ff69a69
3
+ metadata.gz: 8da1d135e89a245bfd27b16cccd06faa055f33f74e0522e0cf736bc32a831a18
4
+ data.tar.gz: 69093f2a2369af691b29eb5ec72adfa6bb5737750a2995f50825a08e4ecfff8c
5
5
  SHA512:
6
- metadata.gz: 7f866a4e89be97fdc9fbc4b989e1120db06e7aa01484295d27fda2a40f2d55add7c0fbcf657c04a7cbf1f01ad168f52e8fa3135ba2c8bc31fbfa6ad5a6ecca05
7
- data.tar.gz: 91d7336bffee88cd0ec9d1a18b2247f106ef7a28dbbc92d47cff65ccea378ef414e41177fdc231b47d61a08d26ef810d1bed6aebe578c7b80d6483323d76f597
6
+ metadata.gz: ddd646b4446b15754faa7a2ac7c3f9500cf042038ca3bf85f5a949e2849bc5ad093878243cf20ba60ba6e06260a5845df5c49eca716dbdaa910e45f0d7ee3fa7
7
+ data.tar.gz: 5265b4aa84051eb530fae0ba012588432975b840a9d6aa45f87918c9d1d75f5064e6aff9ab82a2793d9c1da800e0bd04230457581d7ba6d3825c91dc09cabf17
@@ -18,12 +18,12 @@ module Autopopulater
18
18
  end
19
19
  end
20
20
 
21
- def autopopulate_attributes
21
+ def autopopulate_attributes(overwrite: false)
22
22
  self.class.autopopulated_attributes.each do |a|
23
23
  value = fetch_value(a[:with])
24
24
 
25
25
  a[:keys].each do |attr|
26
- next unless send(attr).blank?
26
+ next unless overwrite || send(attr).blank?
27
27
 
28
28
  send("#{attr}=", attr_value(value, attr))
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Autopopulater
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autopopulater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Van Der Beek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-09 00:00:00.000000000 Z
11
+ date: 2025-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug