duck_record 0.0.15 → 0.0.16

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
  SHA1:
3
- metadata.gz: 6a7d54969d15361adf50337c375c54e7a48ef472
4
- data.tar.gz: feab9768812adce2d166a63494cb6aef69503eb9
3
+ metadata.gz: 50cfc614adaa1a3af48769d41305d88b4ace7149
4
+ data.tar.gz: ba8306b2ac4d88f8e7e69600e6398f6312132746
5
5
  SHA512:
6
- metadata.gz: bc44187a1c2f6f1272461ded1dccf257f88cbeafc3ac8635ab09f79212cbfc661f8d5eebdb92e20aa80efdc5e1d575916ffc4fe0795418ae5f03a7f2cab677a8
7
- data.tar.gz: 306114eb4f427c1acdc753484843a139eb8c2ad05ea73caccff8dda7167269e2630cf0a15147272d88dfc917aed88c9487fdcffa10a8b4edf4e0806ffb7d5cd8
6
+ metadata.gz: d8249209d1c8315953b4b5404b4f591bc9138a24d04fc4af0c9c8c7d75b277a827721b5a2431695baea747b3a0fffe1be460e814b979180853ab3c4f7255769d
7
+ data.tar.gz: f7a092d53c15c85a5938d6558f66d93c4b9f01d1db23e561b76fedfa764d2bfd054270fd622d987c6a740b0994ffa22063ab336c490bf943abef5e554d8acc17
@@ -8,19 +8,18 @@ module DuckRecord #:nodoc:
8
8
  self.include_root_in_json = false
9
9
  end
10
10
 
11
- def serializable_hash(options = nil)
12
- options = options.try(:dup) || {}
13
-
14
- options[:except] = Array(options[:except]).map(&:to_s)
15
-
16
- super(options)
11
+ def serializable_hash(options = {})
12
+ options = (options || {}).reverse_merge except: Array(options[:except]).map(&:to_s)
13
+ super options
17
14
  end
18
15
 
19
16
  private
20
17
 
21
18
  def read_attribute_for_serialization(key)
22
19
  v = send(key)
23
- if v.respond_to?(:to_ary)
20
+ if v.respond_to?(:serializable_hash)
21
+ v.serializable_hash
22
+ elsif v.respond_to?(:to_ary)
24
23
  v.to_ary
25
24
  elsif v.respond_to?(:to_hash)
26
25
  v.to_hash
@@ -1,3 +1,3 @@
1
1
  module DuckRecord
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duck_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - jasl