Class: Wallaby::Configuration
- Inherits:
-
Object
- Object
- Wallaby::Configuration
- Includes:
- Classifier
- Defined in:
- lib/wallaby/configuration.rb,
lib/wallaby/configuration/models.rb,
lib/wallaby/configuration/mapping.rb,
lib/wallaby/configuration/sorting.rb,
lib/wallaby/configuration/features.rb,
lib/wallaby/configuration/metadata.rb,
lib/wallaby/configuration/security.rb,
lib/wallaby/configuration/pagination.rb
Overview
Global configuration
Defined Under Namespace
Classes: Features, Mapping, Metadata, Models, Pagination, Security, Sorting
Instance Attribute Summary collapse
-
#base_controller ⇒ Class
To globally configure the base controller class that ResourcesController should inherit from.
- #logger ⇒ Object
-
#model_paths ⇒ Array<String>
To configure the model folders that Preloader needs to load before everything else.
-
#raise_on_name_error ⇒ Object
Returns the value of attribute raise_on_name_error.
-
#resources_controller ⇒ Class
To globally configure the application controller class that Engine should use.
Instance Method Summary collapse
-
#clear ⇒ Object
Clear all configurations.
-
#custom_models ⇒ Configuration::Models
Models configuration for custom mode.
-
#custom_models=(models) ⇒ Object
To globally configure the models for custom mode.
-
#features ⇒ Configuration::Features
Features configuration.
-
#mapping ⇒ Configuration::Mapping
Mapping configuration.
-
#metadata ⇒ Configuration::Metadata
Metadata configuration.
-
#models ⇒ Configuration::Models
Models configuration.
-
#models=(models) ⇒ Object
To globally configure the models that Wallaby should handle.
-
#pagination ⇒ Configuration::Pagination
Pagination configuration.
-
#security ⇒ Configuration::Security
Security configuration.
-
#sorting ⇒ Configuration::Sorting
Sorting configuration.
Methods included from Classifier
Instance Attribute Details
#base_controller ⇒ Class
To globally configure the base controller class that ResourcesController should inherit from.
If no configuration is given, ResourcesController defaults to inherit from ::ApplicationController from the host Rails app.
58 59 60 |
# File 'lib/wallaby/configuration.rb', line 58 def base_controller to_class @base_controller ||= '::ApplicationController' end |
#logger ⇒ Object
16 17 18 |
# File 'lib/wallaby/configuration.rb', line 16 def logger @logger ||= Rails.logger end |
#model_paths ⇒ Array<String>
To configure the model folders that Preloader needs to load before everything else. Default is ‘%w(app/models)`
39 40 41 |
# File 'lib/wallaby/configuration.rb', line 39 def model_paths @model_paths ||= %w[app/models] end |
#raise_on_name_error ⇒ Object
Returns the value of attribute raise_on_name_error.
10 11 12 |
# File 'lib/wallaby/configuration.rb', line 10 def raise_on_name_error @raise_on_name_error end |
#resources_controller ⇒ Class
To globally configure the application controller class that Engine should use.
If no configuration is given, Engine defaults to use Admin::ApplicationController or ResourcesController from the host Rails app.
79 80 81 82 83 84 85 |
# File 'lib/wallaby/configuration.rb', line 79 def resources_controller to_class( @resources_controller ||= (to_class('Admin::ApplicationController') && \ 'Admin::ApplicationController') || 'Wallaby::ResourcesController' ) end |
Instance Method Details
#clear ⇒ Object
Clear all configurations
152 153 154 |
# File 'lib/wallaby/configuration.rb', line 152 def clear instance_variables.each { |name| instance_variable_set name, nil } end |
#custom_models ⇒ Configuration::Models
Returns models configuration for custom mode.
88 89 90 |
# File 'lib/wallaby/configuration.rb', line 88 def custom_models @custom_models ||= ClassArray.new end |
#custom_models=(models) ⇒ Object
To globally configure the models for custom mode.
98 99 100 |
# File 'lib/wallaby/configuration.rb', line 98 def custom_models=(models) @custom_models = ClassArray.new models.flatten end |
#features ⇒ Configuration::Features
Returns features configuration.
140 141 142 |
# File 'lib/wallaby/configuration.rb', line 140 def features @features ||= Features.new end |
#mapping ⇒ Configuration::Mapping
Returns mapping configuration.
125 126 127 |
# File 'lib/wallaby/configuration.rb', line 125 def mapping @mapping ||= Mapping.new end |
#metadata ⇒ Configuration::Metadata
Returns metadata configuration.
130 131 132 |
# File 'lib/wallaby/configuration.rb', line 130 def @metadata ||= Metadata.new end |
#models ⇒ Configuration::Models
Returns models configuration.
103 104 105 106 107 |
# File 'lib/wallaby/configuration.rb', line 103 def models Deprecator.alert 'config.models.presence', from: '0.3.0', alternative: <<~INSTRUCTION Please use controller_class.models instead. INSTRUCTION end |
#models=(models) ⇒ Object
To globally configure the models that Wallaby should handle.
115 116 117 |
# File 'lib/wallaby/configuration.rb', line 115 def models=(models) self.models.set models end |
#pagination ⇒ Configuration::Pagination
Returns pagination configuration.
135 136 137 |
# File 'lib/wallaby/configuration.rb', line 135 def pagination @pagination ||= Pagination.new end |
#security ⇒ Configuration::Security
Returns security configuration.
120 121 122 |
# File 'lib/wallaby/configuration.rb', line 120 def security @security ||= Security.new end |
#sorting ⇒ Configuration::Sorting
Returns sorting configuration.
145 146 147 148 149 |
# File 'lib/wallaby/configuration.rb', line 145 def sorting Deprecator.alert 'config.sorting.strategy', from: '0.3.0', alternative: <<~INSTRUCTION Please use controller_class.sorting_strategy instead. INSTRUCTION end |