structured_store 1.1.0 → 1.1.1

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: e03aa6f80b366b7dbb2b3312426a4d7da960e4e96d1840523b061a6de20cf17a
4
- data.tar.gz: 24455f358faff6932c5d78d8dc7963f687a35e888b2bafb798d9dae1ca3fe52b
3
+ metadata.gz: bb74ea9b2d3988a8aaa950245e9001ae8f1175a32c1642f2bc98a14d9a6700fb
4
+ data.tar.gz: e1d2b20eded52f15628c47ca1ffcad4c3d550d117ffb28d00b80e6c1b2b7d16d
5
5
  SHA512:
6
- metadata.gz: b76620f3c30d6161424accbd88baede2a265040ab5f3dec5d564a981fad9002eae10e4cef3cb1e86c70b1d311e3d338b12773730e535296c0e794ed0316767ae
7
- data.tar.gz: 5bbb7b690c4490be4948401b36434a67893cb7fcbb7d149dc96245a7f718210676ec5242eff9902acd6d0bddc6c7453abb29571553a7045000a6d3a2df928858
6
+ metadata.gz: 19272c1fd3e3a88cbd384dba293ecc014e8430c0366e4c17ebfced7d289dd6bde49379e343b2ca18458157c392dca537f75405bdbc10b96a5fdffe5e72fe961c
7
+ data.tar.gz: acb2617359e6a4e8853a5684344b4cefeb2dac2c58f5f396a585aad8aefeeb700d487eaceeaf69d29a8057777b7151c5986ff3a4ff7a0d3fc05f5609154eb1d2
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # StructuredStore
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/structured_store.svg)](https://badge.fury.io/rb/structured_store)
4
+
3
5
  StructuredStore is a Ruby gem designed for Rails applications that provides a robust system for managing JSON data using versioned JSON schemas. The library enables developers to store structured data in a JSON database column while maintaining strict schema validation through the json_schemer gem.
4
6
 
5
7
  It features a VersionedSchema model that tracks different versions of JSON schemas using semantic versioning, and a Storable concern that can be included in ActiveRecord models to automatically define accessor methods for schema properties. The gem supports schema evolution by allowing multiple versions of the same schema to coexist, making it ideal for applications that need to maintain backward compatibility while evolving their data structures.
@@ -29,6 +29,32 @@ module StructuredStore
29
29
  class_attribute :_structured_store_configurations, default: []
30
30
  end
31
31
 
32
+ # Override initialize to handle store attributes after accessors are defined
33
+ def initialize(attributes = nil)
34
+ unless attributes.is_a?(Hash)
35
+ super
36
+ return
37
+ end
38
+
39
+ # Separate known from unknown attributes and call super, then re-assign
40
+ known_attrs, unknown_attrs = separate_known_and_unknown_attributes(attributes)
41
+
42
+ super(known_attrs)
43
+
44
+ assign_attributes(unknown_attrs) if unknown_attrs.present?
45
+ end
46
+
47
+ private
48
+
49
+ # Separates known attributes (columns and schema associations) from potential store attributes
50
+ def separate_known_and_unknown_attributes(attributes)
51
+ attributes.each_with_object([{}, {}]) do |(key, value), (known, unknown)|
52
+ (respond_to?(key.to_s) ? known : unknown)[key] = value
53
+ end
54
+ end
55
+
56
+ public
57
+
32
58
  class_methods do
33
59
  # Configures a structured store column and creates the necessary associations.
34
60
  #
@@ -1,3 +1,3 @@
1
1
  module StructuredStore
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structured_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Gentry
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-12-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: json_schemer
@@ -89,7 +88,6 @@ metadata:
89
88
  source_code_uri: https://github.com/HealthDataInsight/structured_store
90
89
  changelog_uri: https://github.com/HealthDataInsight/structured_store/blob/main/CHANGELOG.md
91
90
  rubygems_mfa_required: 'true'
92
- post_install_message:
93
91
  rdoc_options: []
94
92
  require_paths:
95
93
  - lib
@@ -104,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
102
  - !ruby/object:Gem::Version
105
103
  version: '0'
106
104
  requirements: []
107
- rubygems_version: 3.3.26
108
- signing_key:
105
+ rubygems_version: 3.6.9
109
106
  specification_version: 4
110
107
  summary: Store JSON structured using versioned JSON Schemas.
111
108
  test_files: []