Sha256: b1e470a1fc5f3717446644ddd2135fab7ebda7e18effb9c93298a25a71da2dda

Contents?: true

Size: 1.32 KB

Versions: 87

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module Web47core
  #
  # Configuration for the Web47Core platform
  #
  class Config
    include Singleton
    attr_accessor :email_able_models, :switchboard_able_models, :audit_model

    def initialize
      @email_able_models = []
      @switchboard_able_models = []
      @audit_model = :user
    end

    def self.reset
      instance.email_able_models = []
      instance.switchboard_able_models = []
      instance.audit_model = :user
    end

    def self.audit_model_log_class
      audit_model_log_class_name.constantize
    end

    def self.audit_model_log_class_name
      audit_model_log_symbol.camelize
    end

    def self.audit_model_log_symbol
      "#{instance.audit_model}_model_audit_log"
    end

    def self.audit_model_class_name
      instance.audit_model.to_s.camelize
    end

    #
    # Provide access to the instance accessors through static methods
    #
    def self.method_missing(method, *args, &block)
      if instance.respond_to?(method)
        instance.send(method, *args)
      else
        super
      end
    end

    def self.respond_to?(method_name, _include_private = false)
      instance.respond_to?(method_name) || super
    end

    def self.respond_to_missing?(method_name, _include_private = false)
      instance.respond_to?(method_name) || super
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
web47core-2.0.0 lib/web47core/config.rb
web47core-1.1.10 lib/web47core/config.rb
web47core-1.1.9 lib/web47core/config.rb
web47core-1.1.8 lib/web47core/config.rb
web47core-1.1.7 lib/web47core/config.rb
web47core-1.1.6 lib/web47core/config.rb
web47core-1.1.5 lib/web47core/config.rb
web47core-1.1.4 lib/web47core/config.rb
web47core-1.1.3 lib/web47core/config.rb
web47core-1.1.2 lib/web47core/config.rb
web47core-1.1.1 lib/web47core/config.rb
web47core-1.1.0 lib/web47core/config.rb
web47core-1.0.18 lib/web47core/config.rb
web47core-1.0.17 lib/web47core/config.rb
web47core-1.0.16 lib/web47core/config.rb
web47core-1.0.15 lib/web47core/config.rb
web47core-1.0.14 lib/web47core/config.rb
web47core-1.0.13 lib/web47core/config.rb
web47core-1.0.12 lib/web47core/config.rb
web47core-1.0.11 lib/web47core/config.rb