jamespath 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/Rakefile +5 -3
- data/jamespath.gemspec +2 -0
- data/lib/jamespath/version.rb +1 -1
- data/lib/jamespath/vm.rb +1 -1
- data/samus.json +44 -0
- data/test/array_test.rb +19 -0
- metadata +30 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 389e1b7960e5eaafb4287b783247f3d741c63fc3
|
4
|
+
data.tar.gz: d443bf351d6c7a7a72c0f424afccb4afc9a0336d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cc0fc12d58826d6ba256cdf33b02d70360c6a4dbc7a435847f844b8231bf7de0ac3868e2d1541c7636cbb803ab214ee198d50035ab6ecd827907ad29425f546
|
7
|
+
data.tar.gz: 8e6ec05195db66ba6cea57236460b7e1035827aa3908bba94a828e07c303e05e5e5975f0d3f1c27e09e1754cb2c5c9dc5068c43b072e1c75b9b48e24d1a265c2
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Jamespath
|
1
|
+
# Jamespath [![Version](https://badge.fury.io/rb/jamespath.png)](http://badge.fury.io/rb/jamespath) [![Build Status](https://travis-ci.org/lsegal/jamespath.png?branch=master)](https://travis-ci.org/lsegal/jamespath)
|
2
2
|
|
3
3
|
Jamespath is a library that lets you select objects from deeply nested
|
4
4
|
structures, arrays, hashes, or JSON objects using a simple expression
|
data/Rakefile
CHANGED
data/jamespath.gemspec
CHANGED
@@ -6,10 +6,12 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.summary = 'Implements JMESpath declarative object searching.'
|
7
7
|
spec.description = 'Like XPath, but for JSON and other structured objects.'
|
8
8
|
spec.authors = ['Loren Segal', 'Trevor Rowe']
|
9
|
+
spec.email = 'lsegal@soen.ca'
|
9
10
|
spec.homepage = 'http://github.com/lsegal/jamespath'
|
10
11
|
spec.license = 'MIT'
|
11
12
|
spec.files = `git ls-files`.split($/)
|
12
13
|
spec.test_files = spec.files.grep(%r{^test/})
|
14
|
+
spec.add_development_dependency('rake', '~> 10.0')
|
13
15
|
spec.add_development_dependency('yard', '~> 0.0')
|
14
16
|
spec.add_development_dependency('rdiscount', '>= 2.1.7', '< 3.0')
|
15
17
|
end
|
data/lib/jamespath/version.rb
CHANGED
data/lib/jamespath/vm.rb
CHANGED
@@ -105,7 +105,7 @@ module Jamespath
|
|
105
105
|
object[key]
|
106
106
|
elsif ArrayGroup === object
|
107
107
|
object = object.map {|o| get_key(o, key) }.compact
|
108
|
-
object.length > 0 ? ArrayGroup.new(object) : []
|
108
|
+
object.length > 0 ? ArrayGroup.new(object) : ArrayGroup.new([])
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
data/samus.json
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
{
|
2
|
+
"actions": [
|
3
|
+
{
|
4
|
+
"action": "fs-sedfiles",
|
5
|
+
"files": ["lib/*/version.rb"],
|
6
|
+
"arguments": {
|
7
|
+
"search": "VERSION = ['\"](.+?)['\"]",
|
8
|
+
"replace": "VERSION = '$version'"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"action": "git-commit",
|
13
|
+
"files": ["lib/*/version.rb"]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"action": "git-merge",
|
17
|
+
"arguments": {
|
18
|
+
"branch": "master"
|
19
|
+
}
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"action": "archive-git-full",
|
23
|
+
"files": ["git.tgz"],
|
24
|
+
"publish": [{
|
25
|
+
"action": "git-push",
|
26
|
+
"arguments": {
|
27
|
+
"remotes": "origin",
|
28
|
+
"refs": "master v$version"
|
29
|
+
}
|
30
|
+
}]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"action": "gem-build",
|
34
|
+
"files": ["*.gemspec"],
|
35
|
+
"publish": [
|
36
|
+
{
|
37
|
+
"action": "gem-push",
|
38
|
+
"files": ["*.gem"],
|
39
|
+
"credentials": "lsegal.rubygems"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
data/test/array_test.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative '../lib/jamespath'
|
3
|
+
|
4
|
+
describe "Compliance testing" do
|
5
|
+
|
6
|
+
it 'returns an empty array from a failed [] search' do
|
7
|
+
data = {
|
8
|
+
'items' => [
|
9
|
+
{
|
10
|
+
'nestedItems' => [
|
11
|
+
]
|
12
|
+
}
|
13
|
+
]
|
14
|
+
}
|
15
|
+
r = Jamespath.search('items[].nestedItems[].not.there', data)
|
16
|
+
r.must_equal([])
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamespath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
@@ -9,49 +9,63 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '10.0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '10.0'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: yard
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
17
31
|
requirements:
|
18
|
-
- - ~>
|
32
|
+
- - "~>"
|
19
33
|
- !ruby/object:Gem::Version
|
20
34
|
version: '0.0'
|
21
35
|
type: :development
|
22
36
|
prerelease: false
|
23
37
|
version_requirements: !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
|
-
- - ~>
|
39
|
+
- - "~>"
|
26
40
|
- !ruby/object:Gem::Version
|
27
41
|
version: '0.0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: rdiscount
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
31
45
|
requirements:
|
32
|
-
- -
|
46
|
+
- - ">="
|
33
47
|
- !ruby/object:Gem::Version
|
34
48
|
version: 2.1.7
|
35
|
-
- - <
|
49
|
+
- - "<"
|
36
50
|
- !ruby/object:Gem::Version
|
37
51
|
version: '3.0'
|
38
52
|
type: :development
|
39
53
|
prerelease: false
|
40
54
|
version_requirements: !ruby/object:Gem::Requirement
|
41
55
|
requirements:
|
42
|
-
- -
|
56
|
+
- - ">="
|
43
57
|
- !ruby/object:Gem::Version
|
44
58
|
version: 2.1.7
|
45
|
-
- - <
|
59
|
+
- - "<"
|
46
60
|
- !ruby/object:Gem::Version
|
47
61
|
version: '3.0'
|
48
62
|
description: Like XPath, but for JSON and other structured objects.
|
49
|
-
email:
|
63
|
+
email: lsegal@soen.ca
|
50
64
|
executables: []
|
51
65
|
extensions: []
|
52
66
|
extra_rdoc_files: []
|
53
67
|
files:
|
54
|
-
- .gitignore
|
68
|
+
- ".gitignore"
|
55
69
|
- Gemfile
|
56
70
|
- LICENSE
|
57
71
|
- README.md
|
@@ -62,6 +76,8 @@ files:
|
|
62
76
|
- lib/jamespath/tokenizer.rb
|
63
77
|
- lib/jamespath/version.rb
|
64
78
|
- lib/jamespath/vm.rb
|
79
|
+
- samus.json
|
80
|
+
- test/array_test.rb
|
65
81
|
- test/compliance/basic.json
|
66
82
|
- test/compliance/escape.json
|
67
83
|
- test/compliance/indices.json
|
@@ -81,21 +97,22 @@ require_paths:
|
|
81
97
|
- lib
|
82
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
99
|
requirements:
|
84
|
-
- -
|
100
|
+
- - ">="
|
85
101
|
- !ruby/object:Gem::Version
|
86
102
|
version: '0'
|
87
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
104
|
requirements:
|
89
|
-
- -
|
105
|
+
- - ">="
|
90
106
|
- !ruby/object:Gem::Version
|
91
107
|
version: '0'
|
92
108
|
requirements: []
|
93
109
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.2.2
|
95
111
|
signing_key:
|
96
112
|
specification_version: 4
|
97
113
|
summary: Implements JMESpath declarative object searching.
|
98
114
|
test_files:
|
115
|
+
- test/array_test.rb
|
99
116
|
- test/compliance/basic.json
|
100
117
|
- test/compliance/escape.json
|
101
118
|
- test/compliance/indices.json
|