Module: SqAuth::SqAuthIntegration

Defined in:
lib/sq_auth/sq_auth_integration/sq_auth_rack.rb,
lib/sq_auth/sq_auth_integration/sq_auth_sinatra.rb,
lib/sq_auth/sq_auth_integration/sq_auth_integration.rb,
lib/sq_auth/sq_auth_integration/sq_auth_rack_protection.rb,
lib/sq_auth/sq_auth_integration/sq_auth_action_controller.rb

Defined Under Namespace

Modules: SqAuthActionController, SqAuthRack, SqAuthRackProtection, SqAuthSinatra

Class Method Summary collapse

Class Method Details

.alter_environment(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sq_auth/sq_auth_integration/sq_auth_integration.rb', line 3

def self.alter_environment options = {}
  @already_altered ||= []
  alter_modules = SqAuth::SqAuthIntegration.constants.map do |const|
    alter_module = nil
    check_module = SqAuth::SqAuthIntegration.const_get(const)
    if check_module.kind_of?(Module) && check_module.respond_to?(:alter_environment) && check_module.respond_to?(:check_environment)
      alter_module = check_module
    end
    alter_module
  end.compact
  alter_modules.each do |m|
    unless @already_altered.include? m
      if m.check_environment
        @already_altered << m
        m.alter_environment options
      end
    end
  end
end