module EffectiveGem::ClassMethods
Public Instance Methods
config(namespace = nil)
click to toggle source
# File lib/effective_resources/effective_gem.rb, line 15 def config(namespace = nil) namespace ||= Tenant.current if defined?(Tenant) @config.dig(namespace) || @config end
setup(namespace = nil) { |config(namespace)| ... }
click to toggle source
# File lib/effective_resources/effective_gem.rb, line 20 def setup(namespace = nil, &block) @config ||= ActiveSupport::OrderedOptions.new namespace ||= Tenant.current if defined?(Tenant) if namespace @config[namespace] ||= ActiveSupport::OrderedOptions.new end yield(config(namespace)) if(unsupported = (config(namespace).keys - config_keys)).present? if unsupported.include?(:authorization_method) raise("config.authorization_method has been removed. This gem will call EffectiveResources.authorization_method instead. Please double check the config.authorization_method setting in config/initializers/effective_resources.rb and remove it from this file.") end raise("unsupported config keys: #{unsupported}\n supported keys: #{config_keys}") end true end