gql 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d558618a79185b2295c8f915f7c96aedccb92155
4
- data.tar.gz: c8f61acb2a457c7b70ed6de9e5967b5e0a81e02a
3
+ metadata.gz: 741ab8b27d0f0cc62ed7881c379dfd4580895959
4
+ data.tar.gz: 0146bc92a1b05f59716c14c317e790e34c7c1f2e
5
5
  SHA512:
6
- metadata.gz: 209fee25aec3f2cd00f8521a441a920f7bb60952301aa90b69a79eaddc51e2e805cc63d35a037eb43385e16fb430e9e2c833cc0183505af752c49187700693b0
7
- data.tar.gz: 463586ba87299cf239e8a2433d9abe6c7bd51384e56cd93e005a75351c65283c1c0ae7b7f1db31027f2685d92cd2c232613084779be648e8f5e51bc6d4f27826
6
+ metadata.gz: 78191d679e231f86f72faffc00dcbe1f80c9f7b4ae97a896dd281de0f9cd0dc8f5b4564372290e9d1a158b2f874d755883d5f55652813130cf1527df7dc861e4
7
+ data.tar.gz: 64d675caa2ad670aa305848dcc93683053e1d71b01e74a3beaa075bc792e0860e49a21f7d35ec02de303892de3fcf52a813916e9b31a0c08f9197449c8a7cc08
data/README.md CHANGED
@@ -155,7 +155,16 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
155
155
  ## Contributing
156
156
 
157
157
  1. Fork it ( https://github.com/martinandert/gql/fork )
158
- 2. Create your feature branch (`git checkout -b my-new-feature`)
159
- 3. Commit your changes (`git commit -am 'Add some feature'`)
160
- 4. Push to the branch (`git push origin my-new-feature`)
161
- 5. Create a new Pull Request
158
+ 2. Run `bin/setup` to install dependencies.
159
+ 3. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate: `bin/rake test`.
160
+ 4. Create your feature branch (`git checkout -b my-new-feature`)
161
+ 5. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or are fixing a bug, we need a test!
162
+ 6. Make the test pass.
163
+ 7. Commit your changes (`git commit -am 'add some feature'`)
164
+ 8. Push to your fork (`git push origin my-new-feature`)
165
+ 9. Create a new Pull Request
166
+
167
+
168
+ ## License
169
+
170
+ Released under The MIT License.
@@ -10,7 +10,7 @@ module GQL
10
10
  end
11
11
 
12
12
  if value && ENV['DEBUG']
13
- value.call :_schema, -> { context[:_schema_root] }, returns: Schema::Root
13
+ value.call :schema, -> { context[:__schema_root] }, returns: Schema::Root
14
14
  end
15
15
 
16
16
  @@root_node_class = value
@@ -3,6 +3,26 @@ require 'active_support/core_ext/string/inflections'
3
3
 
4
4
  module GQL
5
5
  class Error < StandardError
6
+ attr_reader :code, :handle
7
+
8
+ def initialize(msg, code = 100, handle = nil)
9
+ @code, @handle = code, handle
10
+ super(msg)
11
+ end
12
+
13
+ def as_json
14
+ result = {
15
+ error: {
16
+ code: code,
17
+ type: self.class.name.split('::').last.underscore
18
+ }
19
+ }
20
+
21
+ result[:error][:handle] = handle.to_s if handle
22
+ result[:error][:message] = message if ENV['DEBUG']
23
+
24
+ result
25
+ end
6
26
  end
7
27
 
8
28
  module Errors
@@ -21,7 +41,7 @@ module GQL
21
41
  def initialize(id, node_class)
22
42
  msg = construct_message(node_class, id, 'call', :calls)
23
43
 
24
- super(msg)
44
+ super(msg, 111, id)
25
45
  end
26
46
  end
27
47
 
@@ -29,7 +49,7 @@ module GQL
29
49
  def initialize(id, node_class)
30
50
  msg = construct_message(node_class, id, 'field', :fields)
31
51
 
32
- super(msg)
52
+ super(msg, 112, id)
33
53
  end
34
54
  end
35
55
 
@@ -37,7 +57,7 @@ module GQL
37
57
  def initialize(node_class, super_class)
38
58
  msg = "#{node_class} must be a (subclass of) #{super_class}."
39
59
 
40
- super(msg)
60
+ super(msg, 121)
41
61
  end
42
62
  end
43
63
 
@@ -54,7 +74,7 @@ module GQL
54
74
  msg << "The following field types are currently registered: "
55
75
  msg << GQL.field_types.keys.sort.map { |id| "`#{id}'" }.to_sentence
56
76
 
57
- super(msg)
77
+ super(msg, 122)
58
78
  end
59
79
  end
60
80
 
@@ -63,11 +83,14 @@ module GQL
63
83
  msg = "GQL root node class is not set. "
64
84
  msg << "Set it with `GQL.root_node_class = MyRootNode'."
65
85
 
66
- super(msg)
86
+ super(msg, 123)
67
87
  end
68
88
  end
69
89
 
70
90
  class ScanError < Error
91
+ def initialize(msg)
92
+ super(msg, 131)
93
+ end
71
94
  end
72
95
 
73
96
  class SyntaxError < Error
@@ -75,7 +98,7 @@ module GQL
75
98
  token = 'character' if token == 'error' || token == %Q{"#{value}"}
76
99
  msg = "Unexpected #{token}: `#{value}' (line #{lineno})."
77
100
 
78
- super(msg)
101
+ super(msg, 132, value)
79
102
  end
80
103
  end
81
104
 
@@ -84,7 +107,7 @@ module GQL
84
107
  msg = "#{node_class} must have a #{name} class set. "
85
108
  msg << "Set it with `self.#{name}_class = My#{name.camelize}Class'."
86
109
 
87
- super(msg)
110
+ super(msg, 124)
88
111
  end
89
112
  end
90
113
  end
@@ -12,7 +12,7 @@ module GQL
12
12
 
13
13
  raise Errors::RootClassNotSet if node_class.nil?
14
14
 
15
- context[:_schema_root] = node_class if ENV['DEBUG']
15
+ context[:__schema_root] = node_class if ENV['DEBUG']
16
16
 
17
17
  target = GQL.root_target_proc.call(context)
18
18
 
@@ -16,7 +16,7 @@ require 'gql/tokenizer'
16
16
  module GQL
17
17
  class Parser < Racc::Parser
18
18
 
19
- module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 135)
19
+ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 136)
20
20
 
21
21
  class Query < Struct.new(:root, :variables)
22
22
  def as_json(*)
@@ -81,65 +81,65 @@ module_eval(<<'...end parser.racc/module_eval...', 'parser.racc', 135)
81
81
  racc_action_table = [
82
82
  35, 31, 32, 33, 34, 35, 6, 28, 35, 31,
83
83
  32, 33, 34, 51, 39, 28, 45, 29, 55, 35,
84
- 31, 32, 33, 34, 7, 29, 28, 37, 71, 6,
85
- 46, 38, 14, 6, 70, 12, 29, 35, 31, 32,
84
+ 31, 32, 33, 34, 7, 29, 28, 37, 72, 6,
85
+ 46, 38, 14, 6, 71, 12, 29, 35, 31, 32,
86
86
  33, 34, 12, 10, 28, 35, 31, 32, 33, 34,
87
87
  16, 6, 28, 12, 29, 59, 35, 31, 32, 33,
88
- 34, 67, 29, 28, 43, 68, 39, 72, 41, 65,
89
- 66, 38, 6, 29, 12, 22, 36, 12, 43, 12,
90
- 12, 12, 69, 43, 35 ]
88
+ 34, 68, 29, 28, 43, 69, 39, 73, 42, 66,
89
+ 67, 38, 6, 29, 12, 22, 36, 12, 43, 39,
90
+ 12, 12, 12, 70, 43, 35 ]
91
91
 
92
92
  racc_action_check = [
93
93
  29, 29, 29, 29, 29, 28, 0, 29, 14, 14,
94
94
  14, 14, 14, 28, 21, 14, 21, 29, 29, 22,
95
95
  22, 22, 22, 22, 1, 14, 22, 18, 56, 3,
96
- 22, 18, 5, 22, 56, 6, 22, 66, 66, 66,
97
- 66, 66, 2, 2, 66, 69, 69, 69, 69, 69,
98
- 7, 66, 69, 39, 66, 39, 71, 71, 71, 71,
99
- 71, 52, 69, 71, 20, 52, 20, 60, 20, 47,
100
- 47, 60, 8, 71, 10, 11, 15, 38, 40, 41,
101
- 43, 45, 54, 62, 68 ]
96
+ 22, 18, 5, 22, 56, 6, 22, 67, 67, 67,
97
+ 67, 67, 2, 2, 67, 70, 70, 70, 70, 70,
98
+ 7, 67, 70, 39, 67, 39, 72, 72, 72, 72,
99
+ 72, 52, 70, 72, 20, 52, 20, 60, 20, 47,
100
+ 47, 60, 8, 72, 10, 11, 15, 38, 40, 41,
101
+ 42, 43, 45, 54, 63, 69 ]
102
102
 
103
103
  racc_action_pointer = [
104
104
  -10, 24, 34, 13, nil, 17, 27, 50, 56, nil,
105
105
  66, 63, nil, nil, 6, 59, nil, nil, 17, nil,
106
106
  57, 5, 17, nil, nil, nil, nil, nil, 3, -2,
107
107
  nil, nil, nil, nil, nil, nil, nil, nil, 69, 45,
108
- 71, 71, nil, 72, nil, 73, nil, 56, nil, nil,
109
- nil, nil, 51, nil, 64, nil, 14, nil, nil, nil,
110
- 57, nil, 76, nil, nil, nil, 35, nil, 82, 43,
111
- nil, 54, nil, nil, nil, nil, nil, nil ]
108
+ 71, 70, 72, 73, nil, 74, nil, 56, nil, nil,
109
+ nil, nil, 51, nil, 65, nil, 14, nil, nil, nil,
110
+ 57, nil, nil, 77, nil, nil, nil, 35, nil, 83,
111
+ 43, nil, 54, nil, nil, nil, nil, nil, nil ]
112
112
 
113
113
  racc_action_default = [
114
- -25, -51, -51, -26, -27, -51, -51, -51, -25, -2,
115
- -51, -7, -50, -28, -51, -51, 78, -1, -51, -17,
116
- -23, -6, -51, -29, -31, -32, -33, -34, -51, -51,
117
- -44, -45, -46, -47, -48, -49, -30, -3, -51, -51,
118
- -21, -51, -20, -51, -4, -51, -8, -51, -11, -12,
119
- -13, -35, -51, -38, -51, -40, -51, -43, -16, -14,
120
- -51, -18, -22, -24, -5, -9, -51, -36, -51, -51,
121
- -41, -51, -15, -19, -10, -37, -39, -42 ]
114
+ -26, -52, -52, -27, -28, -52, -52, -52, -26, -2,
115
+ -52, -7, -51, -29, -52, -52, 79, -1, -52, -17,
116
+ -24, -6, -52, -30, -32, -33, -34, -35, -52, -52,
117
+ -45, -46, -47, -48, -49, -50, -31, -3, -52, -52,
118
+ -22, -21, -52, -52, -4, -52, -8, -52, -11, -12,
119
+ -13, -36, -52, -39, -52, -41, -52, -44, -16, -14,
120
+ -52, -18, -19, -23, -25, -5, -9, -52, -37, -52,
121
+ -52, -42, -52, -15, -20, -10, -38, -40, -43 ]
122
122
 
123
123
  racc_goto_table = [
124
- 24, 48, 49, 15, 9, 18, 42, 20, 2, 53,
125
- 54, 40, 44, 1, 8, 57, 17, 21, 47, 58,
126
- 13, 23, 52, 56, nil, nil, 61, nil, nil, nil,
127
- nil, nil, nil, nil, 60, 20, 20, nil, nil, nil,
128
- 63, nil, nil, 62, nil, 74, 49, 64, 73, 75,
129
- 54, nil, nil, nil, nil, 76, nil, 77 ]
124
+ 24, 48, 49, 53, 15, 9, 41, 1, 20, 54,
125
+ 18, 40, 44, 2, 8, 57, 21, 47, 58, 13,
126
+ 23, 17, 52, 56, nil, nil, 61, nil, nil, nil,
127
+ nil, nil, 62, nil, nil, nil, 20, 20, nil, 60,
128
+ nil, 64, nil, nil, 76, 63, 75, 49, 65, 74,
129
+ 54, nil, nil, nil, nil, nil, 77, nil, 78 ]
130
130
 
131
131
  racc_goto_check = [
132
- 12, 10, 11, 6, 4, 5, 14, 6, 2, 22,
133
- 23, 8, 8, 1, 3, 12, 2, 7, 9, 13,
134
- 16, 17, 21, 24, nil, nil, 14, nil, nil, nil,
135
- nil, nil, nil, nil, 5, 6, 6, nil, nil, nil,
136
- 6, nil, nil, 4, nil, 10, 11, 4, 14, 22,
137
- 23, nil, nil, nil, nil, 12, nil, 12 ]
132
+ 12, 10, 11, 22, 6, 4, 14, 1, 6, 23,
133
+ 5, 8, 8, 2, 3, 12, 7, 9, 13, 16,
134
+ 17, 2, 21, 24, nil, nil, 14, nil, nil, nil,
135
+ nil, nil, 8, nil, nil, nil, 6, 6, nil, 5,
136
+ nil, 6, nil, nil, 22, 4, 10, 11, 4, 14,
137
+ 23, nil, nil, nil, nil, nil, 12, nil, 12 ]
138
138
 
139
139
  racc_goto_pointer = [
140
- nil, 13, 8, 12, 2, -5, -3, 6, -9, -4,
141
- -21, -20, -14, -19, -14, nil, 17, 7, nil, nil,
142
- nil, -6, -19, -18, -6 ]
140
+ nil, 7, 13, 12, 3, 0, -2, 5, -9, -5,
141
+ -21, -20, -14, -20, -14, nil, 16, 6, nil, nil,
142
+ nil, -6, -25, -19, -6 ]
143
143
 
144
144
  racc_goto_default = [
145
145
  nil, nil, nil, nil, nil, nil, 11, nil, nil, nil,
@@ -166,42 +166,43 @@ racc_reduce_table = [
166
166
  3, 26, :_reduce_16,
167
167
  1, 26, :_reduce_17,
168
168
  3, 34, :_reduce_18,
169
- 4, 34, :_reduce_19,
170
- 2, 34, :_reduce_20,
169
+ 3, 34, :_reduce_19,
170
+ 4, 34, :_reduce_20,
171
171
  2, 34, :_reduce_21,
172
- 3, 34, :_reduce_22,
173
- 1, 34, :_reduce_23,
174
- 2, 35, :_reduce_24,
175
- 0, 23, :_reduce_25,
172
+ 2, 34, :_reduce_22,
173
+ 3, 34, :_reduce_23,
174
+ 1, 34, :_reduce_24,
175
+ 2, 35, :_reduce_25,
176
+ 0, 23, :_reduce_26,
176
177
  1, 23, :_reduce_none,
177
178
  1, 36, :_reduce_none,
178
- 2, 36, :_reduce_28,
179
- 3, 37, :_reduce_29,
180
- 3, 32, :_reduce_30,
179
+ 2, 36, :_reduce_29,
180
+ 3, 37, :_reduce_30,
181
+ 3, 32, :_reduce_31,
181
182
  1, 38, :_reduce_none,
182
183
  1, 33, :_reduce_none,
183
184
  1, 33, :_reduce_none,
184
185
  1, 33, :_reduce_none,
185
- 2, 39, :_reduce_35,
186
- 3, 39, :_reduce_36,
187
- 3, 42, :_reduce_37,
186
+ 2, 39, :_reduce_36,
187
+ 3, 39, :_reduce_37,
188
+ 3, 42, :_reduce_38,
188
189
  1, 42, :_reduce_none,
189
- 3, 43, :_reduce_39,
190
- 2, 40, :_reduce_40,
191
- 3, 40, :_reduce_41,
192
- 3, 45, :_reduce_42,
193
- 1, 45, :_reduce_43,
190
+ 3, 43, :_reduce_40,
191
+ 2, 40, :_reduce_41,
192
+ 3, 40, :_reduce_42,
193
+ 3, 45, :_reduce_43,
194
+ 1, 45, :_reduce_44,
194
195
  1, 41, :_reduce_none,
195
- 1, 41, :_reduce_45,
196
196
  1, 41, :_reduce_46,
197
197
  1, 41, :_reduce_47,
198
198
  1, 41, :_reduce_48,
199
+ 1, 41, :_reduce_49,
199
200
  1, 44, :_reduce_none,
200
- 1, 27, :_reduce_50 ]
201
+ 1, 27, :_reduce_51 ]
201
202
 
202
- racc_reduce_n = 51
203
+ racc_reduce_n = 52
203
204
 
204
- racc_shift_n = 78
205
+ racc_shift_n = 79
205
206
 
206
207
  racc_token_table = {
207
208
  false => 0,
@@ -418,178 +419,185 @@ module_eval(<<'.,.,', 'parser.racc', 45)
418
419
 
419
420
  module_eval(<<'.,.,', 'parser.racc', 46)
420
421
  def _reduce_19(val, _values, result)
421
- result = Node.new(val[0], val[3], val[2], nil )
422
+ result = Node.new(val[0], val[1], nil, val[2].presence)
422
423
  result
423
424
  end
424
425
  .,.,
425
426
 
426
427
  module_eval(<<'.,.,', 'parser.racc', 47)
427
428
  def _reduce_20(val, _values, result)
428
- result = Node.new(val[0], val[1], nil, nil )
429
+ result = Node.new(val[0], val[3], val[2], nil )
429
430
  result
430
431
  end
431
432
  .,.,
432
433
 
433
434
  module_eval(<<'.,.,', 'parser.racc', 48)
434
435
  def _reduce_21(val, _values, result)
435
- result = Node.new(val[0], nil, nil, val[1].presence)
436
+ result = Node.new(val[0], val[1], nil, nil )
436
437
  result
437
438
  end
438
439
  .,.,
439
440
 
440
441
  module_eval(<<'.,.,', 'parser.racc', 49)
441
442
  def _reduce_22(val, _values, result)
442
- result = Node.new(val[0], nil, val[2], nil )
443
+ result = Node.new(val[0], nil, nil, val[1].presence)
443
444
  result
444
445
  end
445
446
  .,.,
446
447
 
447
448
  module_eval(<<'.,.,', 'parser.racc', 50)
448
449
  def _reduce_23(val, _values, result)
449
- result = Node.new(val[0], nil, nil, nil )
450
+ result = Node.new(val[0], nil, val[2], nil )
450
451
  result
451
452
  end
452
453
  .,.,
453
454
 
454
- module_eval(<<'.,.,', 'parser.racc', 54)
455
+ module_eval(<<'.,.,', 'parser.racc', 51)
455
456
  def _reduce_24(val, _values, result)
456
- result = val[1]
457
+ result = Node.new(val[0], nil, nil, nil )
457
458
  result
458
459
  end
459
460
  .,.,
460
461
 
461
- module_eval(<<'.,.,', 'parser.racc', 58)
462
+ module_eval(<<'.,.,', 'parser.racc', 55)
462
463
  def _reduce_25(val, _values, result)
463
- result = {}
464
+ result = val[1]
464
465
  result
465
466
  end
466
467
  .,.,
467
468
 
468
- # reduce 26 omitted
469
+ module_eval(<<'.,.,', 'parser.racc', 59)
470
+ def _reduce_26(val, _values, result)
471
+ result = {}
472
+ result
473
+ end
474
+ .,.,
469
475
 
470
476
  # reduce 27 omitted
471
477
 
472
- module_eval(<<'.,.,', 'parser.racc', 64)
473
- def _reduce_28(val, _values, result)
478
+ # reduce 28 omitted
479
+
480
+ module_eval(<<'.,.,', 'parser.racc', 65)
481
+ def _reduce_29(val, _values, result)
474
482
  result.update val[1]
475
483
  result
476
484
  end
477
485
  .,.,
478
486
 
479
- module_eval(<<'.,.,', 'parser.racc', 68)
480
- def _reduce_29(val, _values, result)
487
+ module_eval(<<'.,.,', 'parser.racc', 69)
488
+ def _reduce_30(val, _values, result)
481
489
  result = { val[0] => val[2] }
482
490
  result
483
491
  end
484
492
  .,.,
485
493
 
486
- module_eval(<<'.,.,', 'parser.racc', 72)
487
- def _reduce_30(val, _values, result)
494
+ module_eval(<<'.,.,', 'parser.racc', 73)
495
+ def _reduce_31(val, _values, result)
488
496
  result = val[1]
489
497
  result
490
498
  end
491
499
  .,.,
492
500
 
493
- # reduce 31 omitted
494
-
495
501
  # reduce 32 omitted
496
502
 
497
503
  # reduce 33 omitted
498
504
 
499
505
  # reduce 34 omitted
500
506
 
501
- module_eval(<<'.,.,', 'parser.racc', 86)
502
- def _reduce_35(val, _values, result)
507
+ # reduce 35 omitted
508
+
509
+ module_eval(<<'.,.,', 'parser.racc', 87)
510
+ def _reduce_36(val, _values, result)
503
511
  result = {}
504
512
  result
505
513
  end
506
514
  .,.,
507
515
 
508
- module_eval(<<'.,.,', 'parser.racc', 87)
509
- def _reduce_36(val, _values, result)
516
+ module_eval(<<'.,.,', 'parser.racc', 88)
517
+ def _reduce_37(val, _values, result)
510
518
  result = val[1]
511
519
  result
512
520
  end
513
521
  .,.,
514
522
 
515
- module_eval(<<'.,.,', 'parser.racc', 91)
516
- def _reduce_37(val, _values, result)
523
+ module_eval(<<'.,.,', 'parser.racc', 92)
524
+ def _reduce_38(val, _values, result)
517
525
  result.update val[2]
518
526
  result
519
527
  end
520
528
  .,.,
521
529
 
522
- # reduce 38 omitted
530
+ # reduce 39 omitted
523
531
 
524
- module_eval(<<'.,.,', 'parser.racc', 96)
525
- def _reduce_39(val, _values, result)
532
+ module_eval(<<'.,.,', 'parser.racc', 97)
533
+ def _reduce_40(val, _values, result)
526
534
  result = { val[0] => val[2] }
527
535
  result
528
536
  end
529
537
  .,.,
530
538
 
531
- module_eval(<<'.,.,', 'parser.racc', 100)
532
- def _reduce_40(val, _values, result)
539
+ module_eval(<<'.,.,', 'parser.racc', 101)
540
+ def _reduce_41(val, _values, result)
533
541
  result = []
534
542
  result
535
543
  end
536
544
  .,.,
537
545
 
538
- module_eval(<<'.,.,', 'parser.racc', 101)
539
- def _reduce_41(val, _values, result)
546
+ module_eval(<<'.,.,', 'parser.racc', 102)
547
+ def _reduce_42(val, _values, result)
540
548
  result = val[1]
541
549
  result
542
550
  end
543
551
  .,.,
544
552
 
545
- module_eval(<<'.,.,', 'parser.racc', 105)
546
- def _reduce_42(val, _values, result)
553
+ module_eval(<<'.,.,', 'parser.racc', 106)
554
+ def _reduce_43(val, _values, result)
547
555
  result.push val[2]
548
556
  result
549
557
  end
550
558
  .,.,
551
559
 
552
- module_eval(<<'.,.,', 'parser.racc', 106)
553
- def _reduce_43(val, _values, result)
560
+ module_eval(<<'.,.,', 'parser.racc', 107)
561
+ def _reduce_44(val, _values, result)
554
562
  result = val
555
563
  result
556
564
  end
557
565
  .,.,
558
566
 
559
- # reduce 44 omitted
567
+ # reduce 45 omitted
560
568
 
561
- module_eval(<<'.,.,', 'parser.racc', 111)
562
- def _reduce_45(val, _values, result)
569
+ module_eval(<<'.,.,', 'parser.racc', 112)
570
+ def _reduce_46(val, _values, result)
563
571
  result = convert_number(val[0])
564
572
  result
565
573
  end
566
574
  .,.,
567
575
 
568
- module_eval(<<'.,.,', 'parser.racc', 112)
569
- def _reduce_46(val, _values, result)
576
+ module_eval(<<'.,.,', 'parser.racc', 113)
577
+ def _reduce_47(val, _values, result)
570
578
  result = true
571
579
  result
572
580
  end
573
581
  .,.,
574
582
 
575
- module_eval(<<'.,.,', 'parser.racc', 113)
576
- def _reduce_47(val, _values, result)
583
+ module_eval(<<'.,.,', 'parser.racc', 114)
584
+ def _reduce_48(val, _values, result)
577
585
  result = false
578
586
  result
579
587
  end
580
588
  .,.,
581
589
 
582
- module_eval(<<'.,.,', 'parser.racc', 114)
583
- def _reduce_48(val, _values, result)
590
+ module_eval(<<'.,.,', 'parser.racc', 115)
591
+ def _reduce_49(val, _values, result)
584
592
  result = nil
585
593
  result
586
594
  end
587
595
  .,.,
588
596
 
589
- # reduce 49 omitted
597
+ # reduce 50 omitted
590
598
 
591
- module_eval(<<'.,.,', 'parser.racc', 121)
592
- def _reduce_50(val, _values, result)
599
+ module_eval(<<'.,.,', 'parser.racc', 122)
600
+ def _reduce_51(val, _values, result)
593
601
  result = val[0].to_sym
594
602
  result
595
603
  end
@@ -4,8 +4,7 @@ module GQL
4
4
  cursor :id
5
5
 
6
6
  string :id
7
- string :type, -> { target.name }
8
- object :result_class, -> { target.result_class || Placeholder }, node_class: Node
7
+ object :result_class, -> { target.result_class || Placeholder }, node_class: Root
9
8
  array :parameters, -> { (target.proc || target.instance_method(:execute)).parameters }, item_class: Parameter
10
9
  end
11
10
  end
@@ -4,7 +4,6 @@ module GQL
4
4
  cursor :id
5
5
 
6
6
  string :id
7
- string :type, -> { target.name }
8
7
  connection :calls, -> { target.calls.values }, list_class: List, item_class: Call
9
8
  connection :fields, -> { target.fields.values }, list_class: List, item_class: Field
10
9
  end
@@ -1,6 +1,7 @@
1
1
  module GQL
2
2
  module Schema
3
3
  class List < GQL::Node
4
+ call :count, returns: GQL::Number
4
5
  number :count
5
6
 
6
7
  call :reverse
@@ -1,7 +1,7 @@
1
1
  module GQL
2
2
  module Schema
3
3
  class Parameter < GQL::Node
4
- MODES = {
4
+ TYPES = {
5
5
  req: 'required',
6
6
  opt: 'optional',
7
7
  rest: 'rest',
@@ -14,7 +14,11 @@ module GQL
14
14
  cursor -> { target[1].to_s }
15
15
 
16
16
  string :id, -> { target[1].to_s }
17
- string :mode, -> { MODES[target[0]] || target[0].to_s }
17
+ string :type, -> { TYPES[target[0]] || target[0].to_s }
18
+
19
+ def raw_value
20
+ "#{target[1]} (#{TYPES[target[0]] || target[0]})"
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -1,9 +1,14 @@
1
1
  module GQL
2
2
  module Schema
3
3
  class Root < GQL::Node
4
- string :type, -> { target.name }
4
+ string :name
5
+
5
6
  connection :calls, -> { target.calls.values }, list_class: List, item_class: Call
6
7
  connection :fields, -> { target.fields.values }, list_class: List, item_class: Field
8
+
9
+ def raw_value
10
+ target.name
11
+ end
7
12
  end
8
13
  end
9
14
  end
@@ -1,3 +1,3 @@
1
1
  module GQL
2
- VERSION = '0.0.13'
2
+ VERSION = '0.0.14'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Andert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake