declarative_mapper 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/module_helper.rb +8 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9cc46c045e5764992d7b1d32bcb3592b7ba9c5395c3fab5b4310235ea034d99
4
- data.tar.gz: 3b71e5d8bd29438990e45658072cc0fbc1626f7c7bf81f3b8a96dbece9985b65
3
+ metadata.gz: 62dac84089ee16267c61962e89e0b8e3b8ec2802409bbac0747903d37544f7a7
4
+ data.tar.gz: dbeecf0ea54d74159bbd6d9cd9fc62205d08ca0a6e55997ce273790c5d9ba1e8
5
5
  SHA512:
6
- metadata.gz: 30b6ddb1acec922cd238a5d84afd8dae98ebc3939661442df68d1bb41b50bb4bf4669b068dbd9a11601ddc43cc331d5db518e699fb4678c45022719ca61f7322
7
- data.tar.gz: 13e3e1545dd01dbd12108884fa103338b7a7be64b80a882ebd7aca0b2ec2f158522d13b9f5549957609e057c38e3ef9d8ab6d11d912e972b986e64c210b6f1c9
6
+ metadata.gz: a4326086134ea116953757d343e78c7ca2fff70a2a0fe1215472156ead8997d272ace9936ebd7a3083e701623ec6bb83407bb9512300816510217da7caa18364
7
+ data.tar.gz: 64080ee3656bab8cb19549edd9cebc5a1b33cce3671fc19727b026cca172d85706c58b1f1bea3e3c7896edc499e1be17640ff7f5a2451253b77b377614b64015
data/lib/module_helper.rb CHANGED
@@ -43,10 +43,13 @@ module ModuleHelper
43
43
  # {:a=>"a/mother", :b=>{:c=>"b/c/washed", :d=>"b/d/the", :e=>{:f=>"b/e/f/ceiling"}}}
44
44
  #
45
45
  def self.deep_transform_values_with_path(object, path=[], &block)
46
- return yield(object, path) unless object.is_a?(Hash)
47
-
48
- object.map do |key, value|
49
- [key, deep_transform_values_with_path(value, path + [key], &block)]
50
- end.to_h
46
+ case object
47
+ when Hash
48
+ object.map { |k, v| [k, deep_transform_values_with_path(v, path + [k], &block)] }.to_h
49
+ when Array
50
+ object.map { |e| deep_transform_values_with_path(e, path, &block) }
51
+ else
52
+ yield(object, path) unless object.is_a?(Hash)
53
+ end
51
54
  end
52
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: declarative_mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nemytchenko
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-18 00:00:00.000000000 Z
12
+ date: 2019-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport