deco_lite 1.2.0 → 1.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
  SHA256:
3
- metadata.gz: 3025f7b914542580dcaaa18ab1666d0cabb4890e845b7155b1d98f5f917a1da5
4
- data.tar.gz: 597aa821f2edb7683cbd65b48561a64c2cdbbdb50457dae07f8d33e61aeeef1b
3
+ metadata.gz: d5e504d4b1c9442022ff1d9dc1727f1116b3be5bef76cce7c3f0b4373e1d5531
4
+ data.tar.gz: c92ec939a0264e410d01d847521ecbd6432fd67e949858c8cc5183354e4aabd2
5
5
  SHA512:
6
- metadata.gz: bd1786683a6f7a7ceaca9a9cd8bef861edd2d66e40416cb1bf67c75eda7e152f9d7d58ce96c0b4cdf6ae240c353cc9cbc1a5e0421379afb8d92b169a196527e5
7
- data.tar.gz: dbef72b83f45454fd2fa74e9bb94ad6079f45b9759a6729bb6b65e0b33ab657a8d9ea72545c0ffb9a2497310e68515b6bde8b25cc208876a5b0347ca9d65b3db
6
+ metadata.gz: d2e87a67fce2ce3177231eb78ba340bef28b415a67263098ec7c9ee1a99e8b9e670bcbf04f9393c9db98e4f3186c5e34eb90e9db5140ecb88df5de9088304d3f
7
+ data.tar.gz: cc3c507551e330c3b6fe052384106a0deed623a3d842ade9f0d119ee5f0886def3cce4de96737dbeec246c816941e5d62c19f7f62c6260900403d2fac9a15d11
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 1.2.1
2
+ * Bugs
3
+ * Fix bug that did not recognize loaded field values if `attr_accessors` were previously created for the loaded fields due to model validations being present. If `ActiveModel` validators are present on the model, DecoLite will automatically create `attr_accessors` for the fields associated with the validations. The presence of these fields being automatically loaded prohibited any fields subsequently loaded having the same field names to not be recognized as having been loaded, causing validation to validate incorrectly (the model did not recognize the fields as having been loaded).
4
+ * Fix bug that wiped out field values previously loaded if `ActiveModel` validations were present for fields having the same name. This is because DecoLite will automatically create `attr_accessors` for the fields associated with the validations, initializing these automatically created field vars to be initialized to nil. The auto-creation of these `attr_accessors` was taking place in #initialize AFTER the initial load of any Hash passed to #initialize in the :hash param, so the values loaded were getting nilled out.
5
+ * Changes
6
+ * Add specs to test the above scenarios.
7
+
1
8
  ### 1.2.0
2
9
  * Changes
3
10
  * Update the README.md file with better explainations and examples.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deco_lite (1.2.0)
4
+ deco_lite (1.2.1)
5
5
  activemodel (~> 7.0, >= 7.0.3.1)
6
6
  activesupport (~> 7.0, >= 7.0.3.1)
7
7
  immutable_struct_ex (~> 0.2.0)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DecoLite
2
2
 
3
- [![GitHub version](http://badge.fury.io/gh/gangelo%2Fdeco.svg)](https://badge.fury.io/gh/gangelo%2Fdeco_lite)
3
+ [![GitHub version](http://badge.fury.io/gh/gangelo%2Fdeco_lite.svg)](https://badge.fury.io/gh/gangelo%2Fdeco_lite)
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/deco_lite.svg)](https://badge.fury.io/rb/deco_lite)
6
6
 
@@ -136,7 +136,7 @@ wife = {
136
136
  },
137
137
  }
138
138
 
139
- class Couple < DecoLite::Model)
139
+ class Couple < DecoLite::Model
140
140
  def live_together?
141
141
  husband_info_address == wife_info_address
142
142
  end
@@ -21,10 +21,8 @@ module DecoLite
21
21
  load_service.execute(hash: hash, options: load_service_options).tap do |service_hash|
22
22
  service_hash.each_pair do |field_name, value|
23
23
  create_field_accessor field_name: field_name, options: deco_lite_options
24
- unless field_names.include? field_name
25
- yield field_name if block_given?
26
- field_names << field_name
27
- end
24
+ yield field_name if block_given?
25
+ field_names << field_name unless field_names.include? field_name
28
26
  set_field_value(field_name: field_name, value: value, options: deco_lite_options)
29
27
  end
30
28
  end
@@ -34,9 +34,9 @@ module DecoLite
34
34
 
35
35
  hash ||= {}
36
36
 
37
- load_hash!(hash: hash, options: options) if hash.present?
38
-
39
37
  load_hash!(hash: auto_attr_accessors, options: options, add_loaded_fields: false) if auto_attr_accessors?
38
+
39
+ load_hash!(hash: hash, options: options) if hash.present?
40
40
  end
41
41
 
42
42
  validate :validate_required_fields
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Defines the version of this gem.
4
4
  module DecoLite
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deco_lite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gene M. Angelo, Jr.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-01 00:00:00.000000000 Z
11
+ date: 2022-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel