Class: GQL::Config
- Inherits:
-
Object
- Object
- GQL::Config
- Defined in:
- lib/gql/config.rb
Instance Method Summary collapse
- #debug ⇒ Object
- #debug=(value) ⇒ Object
- #default_call_proc ⇒ Object
- #default_call_proc=(value) ⇒ Object
- #default_field_proc ⇒ Object
- #default_field_proc=(value) ⇒ Object
- #default_list_class ⇒ Object
- #default_list_class=(value) ⇒ Object
- #field_types ⇒ Object
- #field_types=(value) ⇒ Object
- #root_class ⇒ Object
- #root_class=(value) ⇒ Object
- #root_target_proc ⇒ Object
- #root_target_proc=(value) ⇒ Object
Instance Method Details
#debug ⇒ Object
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_proc ⇒ Object
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_proc ⇒ Object
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_class ⇒ Object
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_types ⇒ Object
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_class ⇒ Object
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_proc ⇒ Object
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 |