Module: HQ::GraphQL::Types
- Defined in:
- lib/hq/graphql/types.rb,
lib/hq/graphql/types/uuid.rb
Defined Under Namespace
Class Method Summary collapse
- .[](key, is_nil = false) ⇒ Object
- .[]=(key, is_nil = false, value) ⇒ Object
- .register(k, v) ⇒ Object
- .registry ⇒ Object
-
.reset! ⇒ Object
Only being used in testing.
- .type_from_column(column) ⇒ Object
Class Method Details
.[](key, is_nil = false) ⇒ Object
27 28 29 |
# File 'lib/hq/graphql/types.rb', line 27 def self.[](key, is_nil = false) registry[[key, is_nil]] end |
.[]=(key, is_nil = false, value) ⇒ Object
23 24 25 |
# File 'lib/hq/graphql/types.rb', line 23 def self.[]=(key, is_nil = false, value) registry[[key, is_nil]] = value end |
.register(k, v) ⇒ Object
19 20 21 |
# File 'lib/hq/graphql/types.rb', line 19 def self.register(k, v) self[k] = v end |
.registry ⇒ Object
12 13 14 15 16 17 |
# File 'lib/hq/graphql/types.rb', line 12 def self.registry @registry ||= Hash.new do |hash, | klass, nil_klass = Array() hash[] = nil_klass ? nil_query_object(klass) : klass_for(klass) end end |
.reset! ⇒ Object
Only being used in testing
56 57 58 |
# File 'lib/hq/graphql/types.rb', line 56 def self.reset! @registry = nil end |
.type_from_column(column) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/hq/graphql/types.rb', line 31 def self.type_from_column(column) graphql_type = case column.type when :uuid ::HQ::GraphQL::Types::UUID when :json, :jsonb ::GraphQL::Types::JSON when :integer ::GraphQL::Types::Int when :decimal ::GraphQL::Types::Float when :boolean ::GraphQL::Types::Boolean when :date ::GraphQL::Types::ISO8601Date when :datetime ::GraphQL::Types::ISO8601DateTime else ::GraphQL::Types::String end column.array ? [graphql_type] : graphql_type end |