Sha256: 9a2ac0933e7108b1146e12dd987938ba5d24ce317a6667563731d5b1051538b1

Contents?: true

Size: 902 Bytes

Versions: 2

Compression:

Stored size: 902 Bytes

Contents

# frozen_string_literal: true

module SwitchUser
  module Provider
    autoload :Base, 'switch_user/provider/base'
    autoload :Authlogic, 'switch_user/provider/authlogic'
    autoload :Clearance, 'switch_user/provider/clearance'
    autoload :Devise, 'switch_user/provider/devise'
    autoload :RestfulAuthentication, 'switch_user/provider/restful_authentication'
    autoload :Sorcery, 'switch_user/provider/sorcery'
    autoload :Dummy, 'switch_user/provider/dummy'
    autoload :Session, 'switch_user/provider/session'

    def self.init(controller)
      klass_part = if SwitchUser.provider.is_a?(Hash)
                     SwitchUser.provider[:name]
                   else
                     SwitchUser.provider
                   end

      klass_part = klass_part.to_s.classify

      klass = "SwitchUser::Provider::#{klass_part}".constantize

      klass.new(controller)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
switch_user-1.5.2 lib/switch_user/provider.rb
switch_user-1.5.1 lib/switch_user/provider.rb