graphql 1.9.18 → 1.9.19

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: dac791a669cb749de7dbbadbff748e28661e952b13a39ca288d94dd062a6f091
4
- data.tar.gz: 4b95ab1279ba396004a3e0c1e3093ebbd45cdb07f3080e3445eb5c1d9a055741
3
+ metadata.gz: bcb1523bfd45560dc2f14d6eaff84f8f3be278098ce485fa88a8192edd208896
4
+ data.tar.gz: 37a2d6765bf93658e4dff5c4224985da45fa0ecf74df96a118a0c36860ad662c
5
5
  SHA512:
6
- metadata.gz: ee1e35c609f8cb231bbcddf1349f74911f0979a5811046de0172912ea984bd20b2034173be2e3722bcf323b582b0bf072fb1849e5c4bfa0d141a24006b412a5f
7
- data.tar.gz: 91b97da692780076730ff580cfb5281f6116ee85ea097b1d7eaeed16c9f57f4ea936b6da9bc20c1015d8a63638eb054c096e47c2e802afea06ce76956e5753eb
6
+ metadata.gz: 986ec9132416635997ac8920271913186d0d24e440f2c59984a05e0dc5fc67a49b5ed5f41732e7bac2de812266dca64c93586f3a22ee6a153a4dddbb16162d81
7
+ data.tar.gz: bd0455191aa492cf212d4a9ea12513703f318873d6f06c9c1dd2bce75808366ea14c352d2422c079231c8a5cf287a77aa29154c790f648eb4c7314e708fcde52
@@ -7,6 +7,14 @@ require "forwardable"
7
7
  require_relative "./graphql/railtie" if defined? Rails::Railtie
8
8
 
9
9
  module GraphQL
10
+ # forwards-compat for argument handling
11
+ module Ruby2Keywords
12
+ if RUBY_VERSION < "2.7"
13
+ def ruby2_keywords(*)
14
+ end
15
+ end
16
+ end
17
+
10
18
  class Error < StandardError
11
19
  end
12
20
 
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module GraphQL
3
4
  module Define
4
5
  # This object delegates most methods to a dictionary of functions, {@dictionary}.
5
6
  # {@target} is passed to the specified function, along with any arguments and block.
6
7
  # This allows a method-based DSL without adding methods to the defined class.
7
8
  class DefinedObjectProxy
9
+ extend GraphQL::Ruby2Keywords
8
10
  # The object which will be defined by definition functions
9
11
  attr_reader :target
10
12
 
@@ -32,16 +34,11 @@ module GraphQL
32
34
  end
33
35
 
34
36
  # Lookup a function from the dictionary and call it if it's found.
35
- def method_missing(name, *args, **kwargs, &block)
37
+ ruby2_keywords
38
+ def method_missing(name, *args, &block)
36
39
  definition = @dictionary[name]
37
40
  if definition
38
- # Avoid passing `kwargs` when it's not used.
39
- # Ruby 2.7 does fine here, but older Rubies receive too many arguments.
40
- if kwargs.any?
41
- definition.call(@target, *args, **kwargs, &block)
42
- else
43
- definition.call(@target, *args, &block)
44
- end
41
+ definition.call(@target, *args, &block)
45
42
  else
46
43
  msg = "#{@target.class.name} can't define '#{name}'"
47
44
  raise NoDefinitionError, msg, caller
@@ -292,12 +292,18 @@ module GraphQL
292
292
  end
293
293
 
294
294
  class AssignAttribute
295
+ extend GraphQL::Ruby2Keywords
296
+
295
297
  def initialize(attr_name)
296
298
  @attr_assign_method = :"#{attr_name}="
297
299
  end
298
300
 
299
- def call(defn, value)
300
- defn.public_send(@attr_assign_method, value)
301
+ # Even though we're just using the first value here,
302
+ # We have to add a splat here to use `ruby2_keywords`,
303
+ # so that it will accept a `[{}]` input from the caller.
304
+ ruby2_keywords
305
+ def call(defn, *value)
306
+ defn.public_send(@attr_assign_method, value.first)
301
307
  end
302
308
  end
303
309
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GraphQL
3
- VERSION = "1.9.18"
3
+ VERSION = "1.9.19"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.18
4
+ version: 1.9.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Mosolgo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips