form_core 0.0.10 → 0.0.11

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: 8b31039c62309ba6b937b5d46316981d2b004992
4
- data.tar.gz: e5579a0fcfbf52f43d036f785c8db1497f6beb08
3
+ metadata.gz: f06ea851e7a0daf23c2e2b0b60fff9b1eda4d119
4
+ data.tar.gz: ec8c7184fcfd823c8e878b429b6637f235a8ae2d
5
5
  SHA512:
6
- metadata.gz: 86c275e9809a0af77af74e834e23ec665f585015a008ceebc05fac72636b4c1ce4138e501ecca7b918d917bed0d1b825d53f9e40394af94291d394c1925480bd
7
- data.tar.gz: 33abbe43d3da57763e5c012b22dab8994621605dfdb8876943dfd1d3149d1cf34bfc2cbbdb7228728922ac81cc78c47a89094b2944372e54762211efb9c52d43
6
+ metadata.gz: dd00ad60982e68344132be45d5c20ad44cc92b89b7e240f46c01278365edc06c7df7b3cf908d4f40ec3cc98b82cd528bf17d2cb26d82a66c505aa7e50353595b
7
+ data.tar.gz: '04480e1c5ee8bf6666d02e85401b3072ac41562292b9ca214f203b6a3c864b5990fae4723aefbfdd06cca6d43def89da9735f5b81409c83967d88acc251e246c'
@@ -5,7 +5,7 @@ require "yaml"
5
5
  module FormCore
6
6
  class HashCoder < FormCore::Coder # :nodoc:
7
7
  def dump(obj)
8
- obj&.to_h || {}
8
+ obj&.serializable_hash || {}
9
9
  end
10
10
 
11
11
  def load(hash)
@@ -17,7 +17,7 @@ module FormCore
17
17
  def dump(obj)
18
18
  return YAML.dump({}) unless obj
19
19
 
20
- YAML.dump obj.to_h
20
+ YAML.dump obj.serializable_hash
21
21
  end
22
22
 
23
23
  def load(yaml)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FormCore
4
- VERSION = "0.0.10"
4
+ VERSION = "0.0.11"
5
5
  end
@@ -22,6 +22,16 @@ module FormCore
22
22
  "#<VirtualModel:#{self.class.name}:#{object_id} #{inspection}>"
23
23
  end
24
24
 
25
+ def serializable_hash(options = {})
26
+ options = (options || {}).reverse_merge include: _embeds_reflections.keys
27
+ super options
28
+ end
29
+
30
+ def _embeds_reflections
31
+ _reflections.select { |_, v| v.is_a? DuckRecord::Reflection::EmbedsAssociationReflection }
32
+ end
33
+ private :_embeds_reflections
34
+
25
35
  def dump
26
36
  self.class.dump(self)
27
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-17 00:00:00.000000000 Z
11
+ date: 2017-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.6.13
89
+ rubygems_version: 2.6.12
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: A Rails engine providing ability to generate dynamic form.