gql 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gql.rb +2 -3
- data/lib/gql/array.rb +1 -1
- data/lib/gql/boolean.rb +1 -1
- data/lib/gql/call.rb +15 -15
- data/lib/gql/config.rb +1 -1
- data/lib/gql/connection.rb +1 -1
- data/lib/gql/node.rb +20 -9
- data/lib/gql/number.rb +1 -1
- data/lib/gql/object.rb +1 -1
- data/lib/gql/parser.rb +11 -16
- data/lib/gql/{simple.rb → raw.rb} +1 -1
- data/lib/gql/schema/{node.rb → root.rb} +1 -1
- data/lib/gql/string.rb +1 -1
- data/lib/gql/tokenizer.rb +4 -35
- data/lib/gql/version.rb +1 -1
- metadata +20 -14
- data/.gitignore +0 -10
- data/Gemfile +0 -4
- data/Rakefile +0 -35
- data/bin/console +0 -25
- data/bin/rake +0 -16
- data/bin/setup +0 -5
- data/gql.gemspec +0 -29
- data/lib/gql/field.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb700c03e6fe7d133fe2bc42736b5908e66174ac
|
4
|
+
data.tar.gz: da41c9aefb85d60137e6fad700993632f66a5b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf3fcd9f66515866b529288aacf23f31980c2e2acb6d49c0b558f9908de0b6912ebbccbfc24099b93cfd8566c0076b011bae32c10045acc889d03e89934fc924
|
7
|
+
data.tar.gz: fdfa1d2cb54671fb57c340beff95d43c3644874c46b35ff90d825362a8bb6616f6c5afe3981ca1dcb81affa20f9ffcb5c344a47ac16b6e42b69f4714e4c5840e
|
data/lib/gql.rb
CHANGED
@@ -6,13 +6,12 @@ module GQL
|
|
6
6
|
autoload :Connection, 'gql/connection'
|
7
7
|
autoload :Error, 'gql/errors'
|
8
8
|
autoload :Executor, 'gql/executor'
|
9
|
-
autoload :Field, 'gql/field'
|
10
9
|
autoload :List, 'gql/list'
|
11
10
|
autoload :Node, 'gql/node'
|
12
11
|
autoload :Number, 'gql/number'
|
13
12
|
autoload :Object, 'gql/object'
|
14
13
|
autoload :Parser, 'gql/parser'
|
15
|
-
autoload :
|
14
|
+
autoload :Raw, 'gql/raw'
|
16
15
|
autoload :String, 'gql/string'
|
17
16
|
autoload :TestCase, 'gql/test_case'
|
18
17
|
autoload :VERSION, 'gql/version'
|
@@ -32,9 +31,9 @@ module GQL
|
|
32
31
|
autoload :Call, 'gql/schema/call'
|
33
32
|
autoload :Field, 'gql/schema/field'
|
34
33
|
autoload :List, 'gql/schema/list'
|
35
|
-
autoload :Node, 'gql/schema/node'
|
36
34
|
autoload :Parameter, 'gql/schema/parameter'
|
37
35
|
autoload :Placeholder, 'gql/schema/placeholder'
|
36
|
+
autoload :Root, 'gql/schema/root'
|
38
37
|
end
|
39
38
|
|
40
39
|
extend(Module.new {
|
data/lib/gql/array.rb
CHANGED
data/lib/gql/boolean.rb
CHANGED
data/lib/gql/call.rb
CHANGED
@@ -8,6 +8,21 @@ module GQL
|
|
8
8
|
def returns(result_class)
|
9
9
|
self.result_class = result_class
|
10
10
|
end
|
11
|
+
|
12
|
+
def execute(caller_class, ast_node, target, variables, context)
|
13
|
+
args = substitute_variables(ast_node.arguments, variables)
|
14
|
+
target = new(target, context).execute(*args)
|
15
|
+
|
16
|
+
next_class = result_class || caller_class
|
17
|
+
|
18
|
+
result = next_class.new(ast_node, target, variables, context)
|
19
|
+
result.value
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def substitute_variables(args, variables)
|
24
|
+
args.map { |arg| arg.is_a?(::Symbol) ? variables[arg] : arg }
|
25
|
+
end
|
11
26
|
end
|
12
27
|
|
13
28
|
attr_reader :target, :context
|
@@ -19,20 +34,5 @@ module GQL
|
|
19
34
|
def execute(*)
|
20
35
|
raise NotImplementedError, 'override in subclass'
|
21
36
|
end
|
22
|
-
|
23
|
-
def result_for(caller_class, ast_node, variables)
|
24
|
-
args = substitute_variables(ast_node.arguments, variables)
|
25
|
-
target = execute(*args)
|
26
|
-
|
27
|
-
result_class = self.class.result_class || caller_class
|
28
|
-
|
29
|
-
result = result_class.new(ast_node, target, variables, context)
|
30
|
-
result.value
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
def substitute_variables(args, variables)
|
35
|
-
args.map { |arg| arg.is_a?(::Symbol) ? variables[arg] : arg }
|
36
|
-
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/gql/config.rb
CHANGED
data/lib/gql/connection.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_support/core_ext/class/attribute'
|
2
2
|
|
3
3
|
module GQL
|
4
|
-
class Connection <
|
4
|
+
class Connection < Node
|
5
5
|
class_attribute :list_class, instance_accessor: false, instance_predicate: false
|
6
6
|
class_attribute :item_class, instance_accessor: false, instance_predicate: false
|
7
7
|
|
data/lib/gql/node.rb
CHANGED
@@ -17,12 +17,19 @@ module GQL
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
class_attribute :calls, :fields, instance_accessor: false, instance_predicate: false
|
20
|
+
class_attribute :id, :proc, :calls, :fields, instance_accessor: false, instance_predicate: false
|
21
21
|
|
22
22
|
self.calls = {}
|
23
23
|
self.fields = {}
|
24
24
|
|
25
25
|
class << self
|
26
|
+
def build_class(id, proc, options = {})
|
27
|
+
Class.new(self).tap do |field_class|
|
28
|
+
field_class.id = id.to_s
|
29
|
+
field_class.proc = proc
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
26
33
|
def call(id, *args)
|
27
34
|
if id.is_a? Hash
|
28
35
|
id.each do |name, call_class|
|
@@ -76,9 +83,9 @@ module GQL
|
|
76
83
|
def field(id, *args)
|
77
84
|
options = args.extract_options!
|
78
85
|
proc = args.shift || -> { target.public_send(id) }
|
79
|
-
type = options.delete(:type) ||
|
86
|
+
type = options.delete(:type) || Node
|
80
87
|
|
81
|
-
|
88
|
+
Node.validate_is_subclass! type, 'type'
|
82
89
|
|
83
90
|
type.build_class(id, proc, options).tap do |field_class|
|
84
91
|
self.const_set "#{id.to_s.camelize}Field", field_class
|
@@ -90,7 +97,7 @@ module GQL
|
|
90
97
|
id = id_or_proc.is_a?(Proc) ? nil : id_or_proc
|
91
98
|
proc = id ? -> { target.public_send(id) } : id_or_proc
|
92
99
|
|
93
|
-
field :cursor, proc, type:
|
100
|
+
field :cursor, proc, type: Raw
|
94
101
|
end
|
95
102
|
|
96
103
|
def validate_is_subclass!(subclass, name)
|
@@ -104,14 +111,19 @@ module GQL
|
|
104
111
|
end
|
105
112
|
|
106
113
|
def respond_to?(method, *args)
|
107
|
-
GQL.field_types.has_key?(method)
|
114
|
+
super || GQL.field_types.has_key?(method)
|
108
115
|
end
|
109
116
|
|
110
117
|
def method_missing(method, *args, &block)
|
111
118
|
if type = GQL.field_types[method]
|
112
|
-
|
119
|
+
Node.define_singleton_method method do |*margs, &mblock|
|
120
|
+
options = margs.extract_options!.merge(type: type)
|
121
|
+
margs = margs.push(options)
|
122
|
+
|
123
|
+
field(*margs, &mblock)
|
124
|
+
end
|
113
125
|
|
114
|
-
|
126
|
+
send method, *args, &block
|
115
127
|
else
|
116
128
|
super
|
117
129
|
end
|
@@ -144,8 +156,7 @@ module GQL
|
|
144
156
|
raise Errors::UndefinedCall.new(ast_call.id, self.class)
|
145
157
|
end
|
146
158
|
|
147
|
-
|
148
|
-
call.result_for self.class, ast_call, variables
|
159
|
+
call_class.execute(self.class, ast_call, target, variables, context)
|
149
160
|
end
|
150
161
|
|
151
162
|
def value_of_fields(ast_fields)
|
data/lib/gql/number.rb
CHANGED
data/lib/gql/object.rb
CHANGED
data/lib/gql/parser.rb
CHANGED
@@ -27,7 +27,7 @@ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 135)
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
class
|
30
|
+
class Node < Struct.new(:id, :alias_id, :call, :fields)
|
31
31
|
def as_json(*)
|
32
32
|
{
|
33
33
|
id: id,
|
@@ -187,7 +187,7 @@ racc_reduce_table = [
|
|
187
187
|
1, 41, :_reduce_46,
|
188
188
|
1, 41, :_reduce_47,
|
189
189
|
1, 41, :_reduce_48,
|
190
|
-
1, 44, :
|
190
|
+
1, 44, :_reduce_none,
|
191
191
|
1, 27, :_reduce_50 ]
|
192
192
|
|
193
193
|
racc_reduce_n = 51
|
@@ -300,14 +300,14 @@ module_eval(<<'.,.,', 'parser.racc', 4)
|
|
300
300
|
|
301
301
|
module_eval(<<'.,.,', 'parser.racc', 8)
|
302
302
|
def _reduce_2(val, _values, result)
|
303
|
-
result =
|
303
|
+
result = Node.new(nil, nil, val[0], nil )
|
304
304
|
result
|
305
305
|
end
|
306
306
|
.,.,
|
307
307
|
|
308
308
|
module_eval(<<'.,.,', 'parser.racc', 9)
|
309
309
|
def _reduce_3(val, _values, result)
|
310
|
-
result =
|
310
|
+
result = Node.new(nil, nil, nil, val[1])
|
311
311
|
result
|
312
312
|
end
|
313
313
|
.,.,
|
@@ -402,42 +402,42 @@ module_eval(<<'.,.,', 'parser.racc', 41)
|
|
402
402
|
|
403
403
|
module_eval(<<'.,.,', 'parser.racc', 45)
|
404
404
|
def _reduce_18(val, _values, result)
|
405
|
-
result =
|
405
|
+
result = Node.new(val[0], val[2], nil, val[1].presence)
|
406
406
|
result
|
407
407
|
end
|
408
408
|
.,.,
|
409
409
|
|
410
410
|
module_eval(<<'.,.,', 'parser.racc', 46)
|
411
411
|
def _reduce_19(val, _values, result)
|
412
|
-
result =
|
412
|
+
result = Node.new(val[0], val[3], val[2], nil )
|
413
413
|
result
|
414
414
|
end
|
415
415
|
.,.,
|
416
416
|
|
417
417
|
module_eval(<<'.,.,', 'parser.racc', 47)
|
418
418
|
def _reduce_20(val, _values, result)
|
419
|
-
result =
|
419
|
+
result = Node.new(val[0], val[1], nil, nil )
|
420
420
|
result
|
421
421
|
end
|
422
422
|
.,.,
|
423
423
|
|
424
424
|
module_eval(<<'.,.,', 'parser.racc', 48)
|
425
425
|
def _reduce_21(val, _values, result)
|
426
|
-
result =
|
426
|
+
result = Node.new(val[0], nil, nil, val[1].presence)
|
427
427
|
result
|
428
428
|
end
|
429
429
|
.,.,
|
430
430
|
|
431
431
|
module_eval(<<'.,.,', 'parser.racc', 49)
|
432
432
|
def _reduce_22(val, _values, result)
|
433
|
-
result =
|
433
|
+
result = Node.new(val[0], nil, val[2], nil )
|
434
434
|
result
|
435
435
|
end
|
436
436
|
.,.,
|
437
437
|
|
438
438
|
module_eval(<<'.,.,', 'parser.racc', 50)
|
439
439
|
def _reduce_23(val, _values, result)
|
440
|
-
result =
|
440
|
+
result = Node.new(val[0], nil, nil, nil )
|
441
441
|
result
|
442
442
|
end
|
443
443
|
.,.,
|
@@ -577,12 +577,7 @@ module_eval(<<'.,.,', 'parser.racc', 114)
|
|
577
577
|
end
|
578
578
|
.,.,
|
579
579
|
|
580
|
-
|
581
|
-
def _reduce_49(val, _values, result)
|
582
|
-
result = unescape_string(val[0])
|
583
|
-
result
|
584
|
-
end
|
585
|
-
.,.,
|
580
|
+
# reduce 49 omitted
|
586
581
|
|
587
582
|
module_eval(<<'.,.,', 'parser.racc', 121)
|
588
583
|
def _reduce_50(val, _values, result)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module GQL
|
2
2
|
module Schema
|
3
|
-
class
|
3
|
+
class Root < GQL::Node
|
4
4
|
string :type, -> { target.name }
|
5
5
|
connection :calls, -> { target.calls.values }, list_class: List, item_class: Call
|
6
6
|
connection :fields, -> { target.fields.values }, list_class: List, item_class: Field
|
data/lib/gql/string.rb
CHANGED
data/lib/gql/tokenizer.rb
CHANGED
@@ -64,7 +64,7 @@ class GQL::Parser < Racc::Parser
|
|
64
64
|
action { @state = :REM; nil }
|
65
65
|
|
66
66
|
when (text = @ss.scan(/"(?:[^"\\]|\\["\\\/bfnrt]|\\u[0-9a-fA-F]{4})*"/))
|
67
|
-
action { [:STRING,
|
67
|
+
action { [:STRING, convert_json(text)] }
|
68
68
|
|
69
69
|
when (text = @ss.scan(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/))
|
70
70
|
action { [:NUMBER, text] }
|
@@ -131,39 +131,8 @@ class GQL::Parser < Racc::Parser
|
|
131
131
|
end # def _next_token
|
132
132
|
|
133
133
|
private
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
?\\ => '\\',
|
138
|
-
?/ => '/',
|
139
|
-
?b => "\b",
|
140
|
-
?f => "\f",
|
141
|
-
?n => "\n",
|
142
|
-
?r => "\r",
|
143
|
-
?t => "\t",
|
144
|
-
?u => nil,
|
145
|
-
)
|
146
|
-
EMPTY_8BIT_STRING = ''
|
147
|
-
if String.method_defined? :encode
|
148
|
-
EMPTY_8BIT_STRING.force_encoding Encoding::ASCII_8BIT
|
149
|
-
end
|
150
|
-
def unescape_string(str)
|
151
|
-
string = str.gsub(/^"|"$/, '').gsub(%r((?:\\[\\bfnrt"/]|(?:\\u(?:[A-Fa-f\d]{4}))+|\\[\x20-\xff]))n) do |c|
|
152
|
-
if u = UNESCAPE_MAP[$&[1]]
|
153
|
-
u
|
154
|
-
else # \uXXXX
|
155
|
-
bytes = EMPTY_8BIT_STRING.dup
|
156
|
-
i = 0
|
157
|
-
while c[6 * i] == ?\\ && c[6 * i + 1] == ?u
|
158
|
-
bytes << c[6 * i + 2, 2].to_i(16) << c[6 * i + 4, 2].to_i(16)
|
159
|
-
i += 1
|
160
|
-
end
|
161
|
-
JSON.iconv('utf-8', 'utf-16be', bytes)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
if string.respond_to? :force_encoding
|
165
|
-
string.force_encoding ::Encoding::UTF_8
|
166
|
-
end
|
167
|
-
string
|
134
|
+
require 'multi_json'
|
135
|
+
def convert_json(str)
|
136
|
+
MultiJson.load("[#{str}]").first
|
168
137
|
end
|
169
138
|
end # class
|
data/lib/gql/version.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Andert
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2015-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
@@ -72,14 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '4.
|
75
|
+
version: '4.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '4.
|
82
|
+
version: '4.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: multi_json
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- mandert@gmail.com
|
@@ -87,15 +101,8 @@ executables: []
|
|
87
101
|
extensions: []
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
|
-
- ".gitignore"
|
91
|
-
- Gemfile
|
92
104
|
- LICENSE.txt
|
93
105
|
- README.md
|
94
|
-
- Rakefile
|
95
|
-
- bin/console
|
96
|
-
- bin/rake
|
97
|
-
- bin/setup
|
98
|
-
- gql.gemspec
|
99
106
|
- lib/gql.rb
|
100
107
|
- lib/gql/array.rb
|
101
108
|
- lib/gql/boolean.rb
|
@@ -104,18 +111,17 @@ files:
|
|
104
111
|
- lib/gql/connection.rb
|
105
112
|
- lib/gql/errors.rb
|
106
113
|
- lib/gql/executor.rb
|
107
|
-
- lib/gql/field.rb
|
108
114
|
- lib/gql/node.rb
|
109
115
|
- lib/gql/number.rb
|
110
116
|
- lib/gql/object.rb
|
111
117
|
- lib/gql/parser.rb
|
118
|
+
- lib/gql/raw.rb
|
112
119
|
- lib/gql/schema/call.rb
|
113
120
|
- lib/gql/schema/field.rb
|
114
121
|
- lib/gql/schema/list.rb
|
115
|
-
- lib/gql/schema/node.rb
|
116
122
|
- lib/gql/schema/parameter.rb
|
117
123
|
- lib/gql/schema/placeholder.rb
|
118
|
-
- lib/gql/
|
124
|
+
- lib/gql/schema/root.rb
|
119
125
|
- lib/gql/string.rb
|
120
126
|
- lib/gql/test_case.rb
|
121
127
|
- lib/gql/tokenizer.rb
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
dir = File.dirname(__FILE__)
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rake/testtask'
|
5
|
-
|
6
|
-
file 'lib/gql/tokenizer.rb' => 'support/tokenizer.rex' do |t|
|
7
|
-
sh "bundle exec rex #{t.prerequisites.first} --output-file #{t.name}"
|
8
|
-
|
9
|
-
# use custom scan error class
|
10
|
-
sh "sed --in-place 's/class ScanError/class Unused/' #{t.name}"
|
11
|
-
sh "sed --in-place 's/ScanError/GQL::Errors::ScanError/' #{t.name}"
|
12
|
-
end
|
13
|
-
|
14
|
-
file 'lib/gql/parser.rb' => 'support/parser.racc' do |t|
|
15
|
-
if ENV['DEBUG']
|
16
|
-
sh "bundle exec racc --debug --verbose --output-file=#{t.name} #{t.prerequisites.first}"
|
17
|
-
else
|
18
|
-
sh "bundle exec racc --output-file=#{t.name} #{t.prerequisites.first}"
|
19
|
-
end
|
20
|
-
|
21
|
-
# fix indentation of generated parser code to silence test warning
|
22
|
-
sh "sed --in-place 's/ end\s*# module/end #/g' #{t.name}"
|
23
|
-
end
|
24
|
-
|
25
|
-
Rake::TestTask.new :test do |t|
|
26
|
-
t.libs << 'test'
|
27
|
-
t.test_files = Dir.glob("#{dir}/test/cases/**/*_test.rb")
|
28
|
-
# t.warning = true
|
29
|
-
# t.verbose = true
|
30
|
-
end
|
31
|
-
|
32
|
-
task :compile => ['lib/gql/tokenizer.rb', 'lib/gql/parser.rb']
|
33
|
-
task :test => :compile
|
34
|
-
task :release => :test
|
35
|
-
task :default => :test
|
data/bin/console
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'gql'
|
5
|
-
|
6
|
-
require_relative '../test/example'
|
7
|
-
|
8
|
-
def ctxt
|
9
|
-
@ctxt ||= { auth_token: 'ma' }
|
10
|
-
end
|
11
|
-
|
12
|
-
def q(string, context = ctxt)
|
13
|
-
GQL.execute string, context
|
14
|
-
end
|
15
|
-
|
16
|
-
def p(string)
|
17
|
-
GQL.parse string
|
18
|
-
end
|
19
|
-
|
20
|
-
def t(string, &block)
|
21
|
-
GQL.tokenize string, &block
|
22
|
-
end
|
23
|
-
|
24
|
-
require 'irb'
|
25
|
-
IRB.start
|
data/bin/rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# This file was generated by Bundler.
|
4
|
-
#
|
5
|
-
# The application 'rake' is installed as part of a gem, and
|
6
|
-
# this file is here to facilitate running it.
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'pathname'
|
10
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
-
Pathname.new(__FILE__).realpath)
|
12
|
-
|
13
|
-
require 'rubygems'
|
14
|
-
require 'bundler/setup'
|
15
|
-
|
16
|
-
load Gem.bin_path('rake', 'rake')
|
data/bin/setup
DELETED
data/gql.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
5
|
-
require 'gql/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'gql'
|
9
|
-
spec.version = GQL::VERSION
|
10
|
-
spec.authors = ['Martin Andert']
|
11
|
-
spec.email = ['mandert@gmail.com']
|
12
|
-
|
13
|
-
spec.summary = 'A Ruby implementation of Facebook\'s yet-to-be-released GraphQL specification.'
|
14
|
-
spec.homepage = 'https://github.com/martinandert/gql'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
spec.required_ruby_version = '>= 2.2.0'
|
18
|
-
|
19
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|support)/}) }
|
20
|
-
spec.bindir = 'exe'
|
21
|
-
spec.require_paths = ['lib']
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.8'
|
24
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'rexical', '~> 1.0'
|
26
|
-
spec.add_development_dependency 'racc', '~> 1.4'
|
27
|
-
|
28
|
-
spec.add_dependency 'activesupport', '~> 4.2'
|
29
|
-
end
|
data/lib/gql/field.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/class/attribute'
|
2
|
-
|
3
|
-
module GQL
|
4
|
-
class Field < Node
|
5
|
-
class_attribute :id, :proc, instance_accessor: false, instance_predicate: false
|
6
|
-
|
7
|
-
class << self
|
8
|
-
def build_class(id, proc, options = {})
|
9
|
-
Class.new(self).tap do |field_class|
|
10
|
-
field_class.id = id.to_s
|
11
|
-
field_class.proc = proc
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|