class Wallaby::Configuration

Global configuration

Public Instance Methods

base_controller() click to toggle source

@!attribute [r] base_controller To globally configure the base controller class that {Wallaby::ApplicationController} should inherit from.

If no configuration is given, {Wallaby::ApplicationController} defaults to inherit from `::ApplicationController` from the host Rails app. @example To update base controller to `CoreController` in `config/initializers/wallaby.rb`

Wallaby.config do |config|
  config.base_controller = ::CoreController
end

@return [Class] base controller class

# File lib/wallaby/configuration.rb, line 49
def base_controller
  to_class @base_controller ||= '::ApplicationController'
end
base_controller=(base_controller) click to toggle source

@!attribute [w] base_controller

# File lib/wallaby/configuration.rb, line 35
def base_controller=(base_controller)
  @base_controller = to_class_name base_controller
end
clear() click to toggle source

Clear all configurations

# File lib/wallaby/configuration.rb, line 114
def clear
  instance_variables.each { |name| instance_variable_set name, nil }
end
custom_models() click to toggle source

@return [Wallaby::Configuration::Models] models configuration for custom mode

# File lib/wallaby/configuration.rb, line 54
def custom_models
  @custom_models ||= Models.new
end
custom_models=(models) click to toggle source

To globally configure the models for custom mode. @example To update the model classes in `config/initializers/wallaby.rb`

Wallaby.config do |config|
  config.custom_models = [Product, Order]
end

@param models [Array<[Class, String]>] a list of model classes/name strings

# File lib/wallaby/configuration.rb, line 64
def custom_models=(models)
  custom_models.set models
end
features() click to toggle source

@return [Wallaby::Configuration::Features] features configuration

# File lib/wallaby/configuration.rb, line 104
def features
  @features ||= Features.new
end
mapping() click to toggle source

@return [Wallaby::Configuration::Mapping] mapping configuration

# File lib/wallaby/configuration.rb, line 89
def mapping
  @mapping ||= Mapping.new
end
metadata() click to toggle source

@return [Wallaby::Configuration::Metadata] metadata configuration

# File lib/wallaby/configuration.rb, line 94
def metadata
  @metadata ||= Metadata.new
end
model_paths() click to toggle source

@!attribute [r] model_paths To configure the model folders that {Wallaby::Preloader} needs to load before everything else. @example To set the model paths

Wallaby.config do |config|
  config.model_paths = ["app/models", "app/core"]
end

@return [Array<String>] model paths @since 0.2.2

# File lib/wallaby/configuration.rb, line 30
def model_paths
  @model_paths ||= %w(app/models)
end
model_paths=(*model_paths) click to toggle source

@!attribute [w] model_paths

# File lib/wallaby/configuration.rb, line 10
def model_paths=(*model_paths)
  @model_paths =
    model_paths.flatten.compact.presence.try do |paths|
      next paths if paths.all? { |p| p.is_a?(String) }

      raise(
        ArgumentError,
        'Please provide a list of string paths, e.g. `["app/models", "app/core"]`'
      )
    end
end
models() click to toggle source

@return [Wallaby::Configuration::Models] models configuration

# File lib/wallaby/configuration.rb, line 69
def models
  @models ||= Models.new
end
models=(models) click to toggle source

To globally configure the models that Wallaby should handle. @example To update the model classes in `config/initializers/wallaby.rb`

Wallaby.config do |config|
  config.models = [Product, Order]
end

@param models [Array<[Class, String]>] a list of model classes/name strings

# File lib/wallaby/configuration.rb, line 79
def models=(models)
  self.models.set models
end
pagination() click to toggle source

@return [Wallaby::Configuration::Pagination] pagination configuration

# File lib/wallaby/configuration.rb, line 99
def pagination
  @pagination ||= Pagination.new
end
security() click to toggle source

@return [Wallaby::Configuration::Security] security configuration

# File lib/wallaby/configuration.rb, line 84
def security
  @security ||= Security.new
end
sorting() click to toggle source

@return [Wallaby::Configuration::Sorting] sorting configuration

# File lib/wallaby/configuration.rb, line 109
def sorting
  @sorting ||= Sorting.new
end