graphql-client 0.0.4 → 0.0.5

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: d464e8e533865d2ee59f8e1fabd7b50ec8db9798
4
- data.tar.gz: 450317c193095cc71f9393b45f1d7787823f0a21
3
+ metadata.gz: f327b5063c82073f7208c75d7a8e178694b67ce5
4
+ data.tar.gz: 2fba5fd397e36ff3f3cd81cc1515a9dd2573476a
5
5
  SHA512:
6
- metadata.gz: 193a29dfa469c858309d506a021c6733b3a2c9aaa5d2e87ef483b106448391514f84f909294250a569e5efd60d34ee2033b96316674bc571d9d22b939e1a3f9c
7
- data.tar.gz: 3cad891786c8d9e20510919945fe0a781f06c552eae0ddf155ff1da28994571430e05741b33792c3a2c16c2fff95cacaa158aba904d3bbeea8b7ced8ad6d8dc4
6
+ metadata.gz: 55bf804e30c3d080d899d49c2016aab6932699565a95d0eae7e90a16bfcd645077a179ac11c08aba366bb583b4ee7ddf73dafad57bea2c0851f081587a6a0191
7
+ data.tar.gz: f1fe23003faefe5a176c696cfe6fb68b63cb2edc6c0c14bfb65ffb12c823943e4518bffb39b718d5f04270f3f8e8be224280a4990e3e527212b83ba83dcee97c
@@ -90,6 +90,18 @@ module GraphQL
90
90
  end
91
91
  end
92
92
 
93
+ def self.|(other)
94
+ new_fields = self.fields.dup
95
+ other.fields.each do |name, value|
96
+ if new_fields[name]
97
+ new_fields[name] |= value
98
+ else
99
+ new_fields[name] = value
100
+ end
101
+ end
102
+ define(fields: new_fields)
103
+ end
104
+
93
105
  attr_reader :data
94
106
  alias_method :to_h, :data
95
107
 
@@ -25,11 +25,12 @@ module GraphQL
25
25
  self.selections.inject({}) do |h, selection|
26
26
  case selection
27
27
  when Selection
28
- if shadow.include?(selection)
29
- h
30
- else
31
- h.merge!(selection.selection_query_result_classes(shadow: shadow, **kargs))
28
+ if !shadow.include?(selection)
29
+ selection.selection_query_result_classes(shadow: shadow, **kargs).each do |name, klass|
30
+ h[name] ? h[name] |= klass : h[name] = klass
31
+ end
32
32
  end
33
+ h
33
34
  else
34
35
  raise TypeError, "expected selection to be of type Selection, but was #{selection.class}"
35
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub