graphql 1.9.18 → 1.9.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/graphql.rb +8 -0
- data/lib/graphql/define/defined_object_proxy.rb +5 -8
- data/lib/graphql/define/instance_definable.rb +8 -2
- data/lib/graphql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcb1523bfd45560dc2f14d6eaff84f8f3be278098ce485fa88a8192edd208896
|
4
|
+
data.tar.gz: 37a2d6765bf93658e4dff5c4224985da45fa0ecf74df96a118a0c36860ad662c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986ec9132416635997ac8920271913186d0d24e440f2c59984a05e0dc5fc67a49b5ed5f41732e7bac2de812266dca64c93586f3a22ee6a153a4dddbb16162d81
|
7
|
+
data.tar.gz: bd0455191aa492cf212d4a9ea12513703f318873d6f06c9c1dd2bce75808366ea14c352d2422c079231c8a5cf287a77aa29154c790f648eb4c7314e708fcde52
|
data/lib/graphql.rb
CHANGED
@@ -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
|
-
|
37
|
+
ruby2_keywords
|
38
|
+
def method_missing(name, *args, &block)
|
36
39
|
definition = @dictionary[name]
|
37
40
|
if definition
|
38
|
-
|
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
|
-
|
300
|
-
|
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
|
data/lib/graphql/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2020-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|