depth 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/depth/actions.rb +4 -1
- data/lib/depth/version.rb +1 -1
- data/spec/depth/actions_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020e097f5dbedcd06e1ae89f478d5544b672cb7e
|
4
|
+
data.tar.gz: 148d7af877ce2e13d3169e6cf2431127f3f9c473
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a7c92001978b81e328f45a5e764780804e07a0351d9e7f7d6bf83d217d1670c020be962c7c12889c26feba845487b105f8f04530a12f457a73b5038dde6200
|
7
|
+
data.tar.gz: f4d5828f974630b8f690950537d769ee115d0eaa65310f4029772eab79971d459eafb50307df289af34b564f6adb4d7f97bb131db5afc430d1b2f81e4dee7882
|
data/lib/depth/actions.rb
CHANGED
@@ -48,9 +48,12 @@ module Depth
|
|
48
48
|
t.next(route_el.key)
|
49
49
|
end
|
50
50
|
}.object
|
51
|
+
|
52
|
+
return default if parent.nil?
|
53
|
+
|
51
54
|
original_key = route.last.key
|
52
55
|
transformed_key = key_transformer.call(parent, route.last.key)
|
53
|
-
object =
|
56
|
+
object = next_proc.call(parent, transformed_key, original_key)
|
54
57
|
return object unless object.nil?
|
55
58
|
return creation_proc.call(parent, transformed_key, default, original_key) if create && default
|
56
59
|
default
|
data/lib/depth/version.rb
CHANGED
data/spec/depth/actions_spec.rb
CHANGED
@@ -193,6 +193,13 @@ module Depth
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
+
context 'with a missing route should return nil' do
|
197
|
+
it 'should return nil' do
|
198
|
+
route = ['$yo', 0, '$thing', 3, '434']
|
199
|
+
expect(subject.find(route)).to be_nil
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
196
203
|
it 'should let me find an existing value' do
|
197
204
|
route = [['$and', :array], [0, :hash],
|
198
205
|
['#weather', :hash], ['something', :array]]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: depth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|