vine 0.0.2 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/vine.rb +8 -6
- metadata +14 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 96f682859efc44adce1694720595f579dc376894
|
4
|
+
data.tar.gz: 47144efcedf6220b1af99510f586142c07e1f46e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 63a17737b6c83a498600a86668aa7dd17ea517f624e573fc2fbb27196a95691bd50f8a74e3c1cc7376a8931f1f96722ba6a36dae5ee97703402cac7fff884b08
|
7
|
+
data.tar.gz: b44c65c25be5c4c340b1f182ac4edd678c5ad4a3cb94f12ac05165045fe9e609176f947d2241aa9614a5687d38b8dfe36b3fdf0f6b83d68388bc769f7f7ec04d
|
data/lib/vine.rb
CHANGED
@@ -12,16 +12,18 @@ end
|
|
12
12
|
class Hash
|
13
13
|
|
14
14
|
def access(path)
|
15
|
-
|
16
|
-
|
15
|
+
value = self
|
16
|
+
|
17
|
+
path.to_s.split('.').each do |p|
|
17
18
|
if p.to_i.to_s == p
|
18
|
-
|
19
|
+
value = value[p.to_i]
|
19
20
|
else
|
20
|
-
|
21
|
+
value = value[p.to_s] || value[p.to_sym]
|
21
22
|
end
|
22
|
-
break
|
23
|
+
break if value.nil?
|
23
24
|
end
|
24
|
-
|
25
|
+
|
26
|
+
value
|
25
27
|
end
|
26
28
|
|
27
29
|
alias :vine :access
|
metadata
CHANGED
@@ -1,45 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: '0.1'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Cheng
|
7
|
+
- Cheng Guangnan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-06-14 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
email:
|
13
|
+
description: Access nested Hash (JSON) with a string path
|
14
|
+
email: chengguangnan@icloud.com
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
19
18
|
files:
|
20
19
|
- lib/vine.rb
|
21
|
-
homepage: https://github.com/
|
22
|
-
licenses:
|
20
|
+
homepage: https://github.com/chengguangnan/vine
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
23
24
|
post_install_message:
|
24
25
|
rdoc_options: []
|
25
26
|
require_paths:
|
26
27
|
- lib
|
27
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
34
|
requirements:
|
36
|
-
- -
|
35
|
+
- - ">="
|
37
36
|
- !ruby/object:Gem::Version
|
38
37
|
version: '0'
|
39
38
|
requirements: []
|
40
39
|
rubyforge_project:
|
41
|
-
rubygems_version:
|
40
|
+
rubygems_version: 2.4.7
|
42
41
|
signing_key:
|
43
|
-
specification_version:
|
44
|
-
summary: Nested
|
42
|
+
specification_version: 4
|
43
|
+
summary: Nested Hash accessing and Array segementation
|
45
44
|
test_files: []
|