Class: GraphQR::Configuration
- Inherits:
-
Object
- Object
- GraphQR::Configuration
- Defined in:
- lib/graphqr/configuration.rb
Overview
Module responsible for global configuration of the gem
Instance Attribute Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#paginator ⇒ Object
Returns the selected paginator.
-
#paginator=(paginator) ⇒ Object
Sets the preferred paginator TODO: support more than Pagy.
-
#policy_provider ⇒ Object
Returns the selected policy_provider.
-
#policy_provider=(policy_provider) ⇒ Object
Sets the preferred policy_provider TODO: support CanCan.
Instance Attribute Details
#use_authorization ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/graphqr/configuration.rb', line 21 def if instance_variable_defined? : else = true end end |
#use_pagination ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/graphqr/configuration.rb', line 13 def use_pagination if instance_variable_defined? :@use_pagination @use_pagination else @use_pagination = true end end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
9 10 11 |
# File 'lib/graphqr/configuration.rb', line 9 def configure yield self end |
#paginator ⇒ Object
Returns the selected paginator. If no paginator is selected, it tries to find the one used
32 33 34 35 36 37 38 |
# File 'lib/graphqr/configuration.rb', line 32 def paginator if instance_variable_defined? :@paginator @paginator else set_paginator end end |
#paginator=(paginator) ⇒ Object
Sets the preferred paginator TODO: support more than Pagy
43 44 45 46 47 48 49 50 |
# File 'lib/graphqr/configuration.rb', line 43 def paginator=(paginator) case paginator.to_sym when :pagy use_pagy else raise StandardError, "Unknown paginator: #{paginator}" end end |
#policy_provider ⇒ Object
Returns the selected policy_provider. If no policy_provider is selected, it tries to find the one used
55 56 57 58 59 60 61 |
# File 'lib/graphqr/configuration.rb', line 55 def policy_provider if instance_variable_defined? :@policy_provider @policy_provider else set_policy_provider end end |
#policy_provider=(policy_provider) ⇒ Object
Sets the preferred policy_provider TODO: support CanCan
66 67 68 69 70 71 72 73 |
# File 'lib/graphqr/configuration.rb', line 66 def policy_provider=(policy_provider) case policy_provider.to_sym when :pundit use_pundit else raise StandardError, "Unknown policy_provider: #{policy_provider}" end end |