graphql-activerecord 0.5.0 → 0.5.1
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/models/active_record_extension.rb +20 -1
- data/lib/graphql/models/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c290d7eba123ca6319d2f0733350a11eb762cc1f
|
4
|
+
data.tar.gz: 43a00144023a3d702be63f3e1bee2f5feb31e962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26c55b9965da8c366ea5167b2b1bcfc0d017b6b8e6d18a4a31ab9729a959bd22cb8bb12326ddc1d09c9b57bd3f8def1ca15a58b713928610393db8b3db9b6cde
|
7
|
+
data.tar.gz: f0206418a86495e0df6af8f38ee62ff674f3e2709c96a42c5e697ebb613d7238b59fe40a6294c7b1c530c3e68b1d653151f58f20619011834a9d3126d8ad1466
|
@@ -1,10 +1,29 @@
|
|
1
1
|
module GraphQL
|
2
2
|
module Models
|
3
3
|
module ActiveRecordExtension
|
4
|
+
class EnumTypeHash
|
5
|
+
extend Forwardable
|
6
|
+
|
7
|
+
attr_accessor :hash
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@hash = {}.with_indifferent_access
|
11
|
+
end
|
12
|
+
|
13
|
+
def [](attribute)
|
14
|
+
type = hash[attribute]
|
15
|
+
type = type.call if type.is_a?(Proc)
|
16
|
+
type = type.constantize if type.is_a?(String)
|
17
|
+
type
|
18
|
+
end
|
19
|
+
|
20
|
+
def_delegators :@hash, :[]=, :include?, :keys
|
21
|
+
end
|
22
|
+
|
4
23
|
extend ActiveSupport::Concern
|
5
24
|
class_methods do
|
6
25
|
def graphql_enum_types
|
7
|
-
@_graphql_enum_types ||=
|
26
|
+
@_graphql_enum_types ||= EnumTypeHash.new
|
8
27
|
end
|
9
28
|
|
10
29
|
# Defines a GraphQL enum type on the model
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphql-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Foster
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|