graphql-sources 1.2.0 → 1.3.0

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
  SHA256:
3
- metadata.gz: e4c4a0eb243aaeb9d8758eb240a5024388ddcc18ae7ea215dcaf85500983fccd
4
- data.tar.gz: f50bb59ddc1deb73af6887929f2e8312292be726806d4a9e0391df7f23f7e29c
3
+ metadata.gz: b4484ab76e8479321a3b7c451654dfbf6f4d2bc8468305829e45d9edfebf7115
4
+ data.tar.gz: e4838bff5cd3e1755e5a5cb3a714ba0502fdf2c24c6db4aeec190e45b2d9f238
5
5
  SHA512:
6
- metadata.gz: 8d7e3ee3f499619863e9296477cce3ca7d727d381947d9ab33a5df2389b4ed5e9e3ccb94ef7c1e52b24928a3299166731357117f50015a6486bb9125e3c809af
7
- data.tar.gz: 84aa0af376e29d8f3575a18a3d0181668fb9d46df96b5d039c4396cdd4c3b6751124ed32b7a2202453ea83c45cc62263a081fd5df6a8cd4ff145cf80998f00a2
6
+ metadata.gz: 7f4ffac3729a6210f9a4ec7b5fbeebe37442d0e4c3578714e1648bc136b51f7abfe71b28432253607580c475f9c1f74992226f5af363857a715554dce0e92393
7
+ data.tar.gz: f10d7510af4681949aac56d252496da8d633151cd0151e9f34bf920e9d9d192c9943e869f506f2c92c4733c1a8662070173fb923405aa66f3f4967642d46907f
data/Gemfile CHANGED
@@ -3,3 +3,7 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ gem 'rake'
8
+ gem 'rspec'
9
+ gem 'rubocop'
@@ -6,7 +6,16 @@ module GraphQL
6
6
  class ActiveRecordBase < GraphQL::Dataloader::Source
7
7
  # @param model [Class] a child class of ActiveRecord::Base (e.g. Comment)
8
8
  # @param key [Symbol] an attribute (typically a foreign key) to use for loading (e.g. :user_id)
9
- def initialize(model, key:)
9
+ # @return [Array] a key
10
+ def self.batch_key_for(model, key: :id)
11
+ return [model.to_sql, key] if model.is_a?(ActiveRecord::Relation)
12
+
13
+ [model, key]
14
+ end
15
+
16
+ # @param model [Class] a child class of ActiveRecord::Base (e.g. Comment)
17
+ # @param key [Symbol] an attribute (typically a foreign key) to use for loading (e.g. :user_id)
18
+ def initialize(model, key: :id)
10
19
  super()
11
20
  @model = model
12
21
  @key = key
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module Sources
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-sources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-20 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rubocop-rspec_rails
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: simplecov
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -234,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
248
  - !ruby/object:Gem::Version
235
249
  version: '0'
236
250
  requirements: []
237
- rubygems_version: 3.4.20
251
+ rubygems_version: 3.5.11
238
252
  signing_key:
239
253
  specification_version: 4
240
254
  summary: A set of common GraphQL DataLoader sources.