Sha256: e56db71ebccadf66a7aaec64aa7d2c0fe17387bf5d208a2aba20430680dc6ffb

Contents?: true

Size: 1.44 KB

Versions: 9

Compression:

Stored size: 1.44 KB

Contents

require 'singleton'
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'
require 'rails_base/configuration/templates'

module RailsBase
  class Config
    include Singleton

    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,
      templates: 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

9 entries across 9 versions & 1 rubygems

Version Path
rails_base-0.72.1 lib/rails_base/config.rb
rails_base-0.72.0 lib/rails_base/config.rb
rails_base-0.71.0 lib/rails_base/config.rb
rails_base-0.70.1.pre lib/rails_base/config.rb
rails_base-0.70.0 lib/rails_base/config.rb
rails_base-0.61.0 lib/rails_base/config.rb
rails_base-0.60.0 lib/rails_base/config.rb
rails_base-0.58.0 lib/rails_base/config.rb
rails_base-0.57.0 lib/rails_base/config.rb