Class: GQL::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/gql/config.rb

Instance Method Summary collapse

Instance Method Details

#default_list_classObject



34
35
36
# File 'lib/gql/config.rb', line 34

def default_list_class
  @@default_list_class ||= Node
end

#default_list_class=(value) ⇒ Object



38
39
40
# File 'lib/gql/config.rb', line 38

def default_list_class=(value)
  @@default_list_class = value
end

#field_typesObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/gql/config.rb', line 19

def field_types
  @@field_types ||= {
    array:      Array,
    boolean:    Boolean,
    connection: Connection,
    number:     Number,
    object:     Object,
    string:     String
  }
end

#field_types=(value) ⇒ Object



30
31
32
# File 'lib/gql/config.rb', line 30

def field_types=(value)
  @@field_types = value
end

#root_node_classObject



3
4
5
# File 'lib/gql/config.rb', line 3

def root_node_class
  @@root_node_class ||= nil
end

#root_node_class=(value) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gql/config.rb', line 7

def root_node_class=(value)
  unless value.nil? || value <= Node
    raise Errors::InvalidNodeClass.new(value, Node)
  end

  if ENV['DEBUG']
    value.call :_schema, -> { context[:_schema_root] }, returns: Schema::Root
  end

  @@root_node_class = value
end