Class: GQL::Config

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

Instance Method Summary collapse

Instance Method Details

#debugObject



58
59
60
61
62
63
64
65
# File 'lib/gql/config.rb', line 58

def debug
  if defined? @@debug
    @@debug
  else
    @@debug = nil
    self.debug = ENV.has_key?('DEBUG')
  end
end

#debug=(value) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/gql/config.rb', line 67

def debug=(value)
  value = !!value

  @@debug = nil unless defined?(@@debug)

  return if value == @@debug

  if value
    Field.object :__type__, -> { field_class }, object_class: 'GQL::Schema::Field'
  else
    Field.remove_field :__type__
  end

  @@debug = value
end

#default_call_procObject



50
51
52
# File 'lib/gql/config.rb', line 50

def default_call_proc
  @@default_call_proc ||= -> id { -> (*args) { target.public_send(id, *args) } }
end

#default_call_proc=(value) ⇒ Object



54
55
56
# File 'lib/gql/config.rb', line 54

def default_call_proc=(value)
  @@default_call_proc = value
end

#default_field_procObject



42
43
44
# File 'lib/gql/config.rb', line 42

def default_field_proc
  @@default_field_proc ||= -> id { -> { target.public_send(id) } }
end

#default_field_proc=(value) ⇒ Object



46
47
48
# File 'lib/gql/config.rb', line 46

def default_field_proc=(value)
  @@default_field_proc = value
end

#default_list_classObject



26
27
28
# File 'lib/gql/config.rb', line 26

def default_list_class
  @@default_list_class ||= 'GQL::Field'
end

#default_list_class=(value) ⇒ Object



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

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

#field_typesObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/gql/config.rb', line 11

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

#field_types=(value) ⇒ Object



22
23
24
# File 'lib/gql/config.rb', line 22

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

#root_classObject



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

def root_class
  @@root_class ||= nil
end

#root_class=(value) ⇒ Object



7
8
9
# File 'lib/gql/config.rb', line 7

def root_class=(value)
  @@root_class = value
end

#root_target_procObject



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

def root_target_proc
  @@root_target_proc ||= -> { nil }
end

#root_target_proc=(value) ⇒ Object



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

def root_target_proc=(value)
  @@root_target_proc = value
end