apiql 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apiql.gemspec +1 -1
- data/lib/apiql.rb +10 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63b4f97269f59d36c635c7b748139aaa028ee54d39693d6f0f44e047448fbf50
|
4
|
+
data.tar.gz: 2b349ebef9fc19be13bff57f40a3b35dbb9b87fd749087da5b57f2d853442c83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca5733013a1f7346c3ec80f9baab183694d8a2681a1f91d926c7827ae2d52014389a050d6ff5b3aefbec9da46e0bb28a5b89fc0d68cf318d62fa6f7e8baf03ea
|
7
|
+
data.tar.gz: e6b7644edb288b4cf7f4b729706b292e4ca0aad43e251bf4862cb7024ccf15e12b60306616a0b9075ed3648209b6ff18ac41084dd7bb9968b1de680becb9b1e6
|
data/apiql.gemspec
CHANGED
data/lib/apiql.rb
CHANGED
@@ -101,15 +101,15 @@ class APIQL
|
|
101
101
|
end
|
102
102
|
|
103
103
|
ptr.push(key)
|
104
|
-
elsif reg = schema.match(/\A\s*(?<name>[\w\.]+)(\((?<params>((\w+)(\s*\,\s*\w+)*))?\))?\s*\{(?<rest>.*)\z/m)
|
104
|
+
elsif reg = schema.match(/\A\s*((?<alias>[\w\.]+):\s*)?(?<name>[\w\.]+)(\((?<params>((\w+)(\s*\,\s*\w+)*))?\))?\s*\{(?<rest>.*)\z/m)
|
105
105
|
schema = reg[:rest]
|
106
106
|
|
107
107
|
pool.push(ptr)
|
108
|
-
ptr.push("#{reg[:name]}(#{reg[:params]})" => (ptr = []))
|
109
|
-
elsif reg = schema.match(/\A\s*(?<name>[\w\.]+)(\((?<params>((\w+)(\s*\,\s*\w+)*))?\))?\s*\n?(?<rest>.*)\z/m)
|
108
|
+
ptr.push("#{reg[:alias] || reg[:name]}: #{reg[:name]}(#{reg[:params]})" => (ptr = []))
|
109
|
+
elsif reg = schema.match(/\A\s*((?<alias>[\w\.]+):\s*)?(?<name>[\w\.]+)(\((?<params>((\w+)(\s*\,\s*\w+)*))?\))?\s*\n?(?<rest>.*)\z/m)
|
110
110
|
schema = reg[:rest]
|
111
111
|
|
112
|
-
ptr.push("#{reg[:name]}(#{reg[:params]})")
|
112
|
+
ptr.push("#{reg[:alias] || reg[:name]}: #{reg[:name]}(#{reg[:params]})")
|
113
113
|
else
|
114
114
|
raise Error, schema
|
115
115
|
end
|
@@ -138,9 +138,10 @@ class APIQL
|
|
138
138
|
schema.map do |call|
|
139
139
|
if call.is_a? ::Hash
|
140
140
|
call.each do |function, sub_schema|
|
141
|
-
reg = function.match(/\A(?<name>[\w\.]+)(\((?<params>.*?)\))?\z/)
|
141
|
+
reg = function.match(/\A((?<alias>[\w\.]+):\s*)?(?<name>[\w\.]+)(\((?<params>.*?)\))?\z/)
|
142
142
|
raise Error, function unless reg.present?
|
143
143
|
|
144
|
+
name = reg[:alias] || reg[:name]
|
144
145
|
function = reg[:name]
|
145
146
|
params = @context.parse_params(reg[:params].presence)
|
146
147
|
|
@@ -154,12 +155,13 @@ class APIQL
|
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
157
|
-
result[
|
158
|
+
result[name] = @context.render_value(data, sub_schema)
|
158
159
|
end
|
159
160
|
else
|
160
|
-
reg = call.match(/\A(?<name>[\w\.]+)(\((?<params>.*?)\))?\z/)
|
161
|
+
reg = call.match(/\A((?<alias>[\w\.]+):\s*)?(?<name>[\w\.]+)(\((?<params>.*?)\))?\z/)
|
161
162
|
raise Error, call unless reg.present?
|
162
163
|
|
164
|
+
name = reg[:alias] || reg[:name]
|
163
165
|
function = reg[:name]
|
164
166
|
params = @context.parse_params(reg[:params].presence)
|
165
167
|
|
@@ -173,7 +175,7 @@ class APIQL
|
|
173
175
|
data = nil
|
174
176
|
end
|
175
177
|
|
176
|
-
result[
|
178
|
+
result[name] = data
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apiql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Silchenko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|