graphql-activerecord 0.5.0 → 0.5.1

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: e776f9bc85c5d4a191d6fb030fe41b2de2a7a52e
4
- data.tar.gz: 55a459231c7e67dfbec908637446952f41af703f
3
+ metadata.gz: c290d7eba123ca6319d2f0733350a11eb762cc1f
4
+ data.tar.gz: 43a00144023a3d702be63f3e1bee2f5feb31e962
5
5
  SHA512:
6
- metadata.gz: b64aa499d1d6773cbb81c333ed76ecc5bbd559793ae33e0eeeb49d002e372399e6270205b8aa62e2bee575c193073ad3f5560712ee62f873049c1532314a0ecb
7
- data.tar.gz: 55f8c84efa13e1dd6233490ff44e90c970816d7fa9325c80fa64cfe7c82943d2b5ab32bc4d827a5038ab0e12510e619694f7b21a7e7235e44fede56207b982f6
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 ||= {}.with_indifferent_access
26
+ @_graphql_enum_types ||= EnumTypeHash.new
8
27
  end
9
28
 
10
29
  # Defines a GraphQL enum type on the model
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Models
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
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.0
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-12 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql