decanter 0.6.1 → 0.6.2

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: 74af646a74ac00a0b36c73c284c274d963221da3
4
- data.tar.gz: 8ffe571e53f2cc0336b3f27f4596ded2cfc8ef11
3
+ metadata.gz: 42bc613e6f1049e3332f4ed3bad67d6031be513c
4
+ data.tar.gz: bc2fbd47a658c6dc924ea3de2667ab73c6c3b723
5
5
  SHA512:
6
- metadata.gz: 23b89721b97b724207119589ffa77c32d89f327fa535f3d46c85769c25de9bc642bd9dc6d2e3564afd658d7bd9ea729c7a23188ca7c086f9dec4d4d920e4ecf8
7
- data.tar.gz: 12efaa603890c42fa00a8ad072b03237d118388ce903e82898d91bcfe378e274e5ab8e77e286478581021c7bb9641463f4d97ed80d51a27b31f12a7643ec21c1
6
+ metadata.gz: 43919de7aab2fce821689d08b631ff3e18226cd6e54823d979521073df659fe14bdd2178bac3713f3dc6c0399c58867ed0eb2cbda4b94c14ab035e2489fa57ef
7
+ data.tar.gz: ae021eb752244c37311232ec2b1213755c2f20efaa7b16bca9a3d7200ce8db052e8a9c74bc6fcb9e21775a487f04127216c9dc62dfa1e312c1fbe52365ff23d3
data/lib/decanter/core.rb CHANGED
@@ -60,7 +60,6 @@ module Decanter
60
60
  # protected
61
61
 
62
62
  def unhandled_keys(args)
63
-
64
63
  unhandled_keys = args.keys.map(&:to_sym) - handlers.keys.flatten.uniq
65
64
 
66
65
  if unhandled_keys.any?
@@ -95,10 +94,18 @@ module Decanter
95
94
  end
96
95
 
97
96
  def handle_has_many(handler, values)
98
- decanter = decanter_for_handler(handler)
97
+ decanter = decanter_for_handler(handler)
98
+ if values.is_a?(Hash)
99
+ parsed_values = values.map do |index, input_values|
100
+ next if input_values.nil?
101
+ decanter.decant(input_values)
102
+ end
103
+ return { handler[:key] => parsed_values }
104
+ else
99
105
  {
100
106
  handler[:key] => values.compact.map { |value| decanter.decant(value) }
101
107
  }
108
+ end
102
109
  end
103
110
 
104
111
  def handle_has_one(handler, values)
@@ -1,3 +1,3 @@
1
1
  module Decanter
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decanter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Francis
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-02-17 00:00:00.000000000 Z
12
+ date: 2016-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport