Sha256: 6c8c87f0e40691d6281deeeb8917d2fb3a497ff05c6993a2ac9e41e652098880

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

require 'rails_base/configuration/admin'
require 'rails_base/configuration/mfa'
require 'rails_base/configuration/authentication'
require 'rails_base/configuration/redis'
require 'rails_base/configuration/owner'
require 'rails_base/configuration/mailer'
require 'rails_base/configuration/exceptions_app'
require 'rails_base/configuration/app'
require 'rails_base/configuration/appearance'
require 'rails_base/configuration/user'
require 'rails_base/configuration/login_behavior'
require 'rails_base/configuration/active_job'

module RailsBase
  class Config
    VARIABLES = {
      admin: nil,
      mfa: nil,
      auth: :authentication,
      redis: nil,
      owner: nil,
      mailer: nil,
      exceptions_app: nil,
      app: nil,
      appearance: nil,
      user: nil,
      active_job: nil,
      login_behavior: nil
    }
    attr_reader *VARIABLES.keys

    def initialize
      VARIABLES.each do |variable, override|
        klass_name = (override || variable).to_s.camelize
        klass = "RailsBase::Configuration::#{klass_name}".constantize
        instance_variable_set(:"@#{variable}", klass.new)
      end
    end

    def validate_configs!
      VARIABLES.keys.each do |var|
        send(var).validate!
      end
    end

    def reset_config!
      VARIABLES.keys.each do |var|
        send(var).assign_default_values!
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_base-0.53.0 lib/rails_base/config.rb
rails_base-0.52.3 lib/rails_base/config.rb
rails_base-0.52.1 lib/rails_base/config.rb
rails_base-0.52.0 lib/rails_base/config.rb
rails_base-0.51.1 lib/rails_base/config.rb
rails_base-0.51.0 lib/rails_base/config.rb