Class: YiffSpace::Auth::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/yiffspace/auth/engine.rb

Class Method Summary collapse

Class Method Details

.for(name) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/yiffspace/auth/engine.rb', line 34

def for(name)
  @instances              ||= {}
  @instances[name.to_sym] ||= begin
    subclass = Class.new(self)
    subclass.engine_name("yiffspace_auth_#{name}")
    # Inherit isolation settings that aren't copied from the parent class
    subclass.instance_variable_set(:@isolated, true)
    subclass.routes.default_scope = { module: "yiffspace/auth" }
    subclass.routes.draw do
      constraints(SetClientName.new(name)) do
        get(:cb, controller: :root)
        get(:logout, controller: :root)
        get(:permissions, controller: :root)
        get(:debug, controller: :root) if ::YiffSpace::Auth.enable_debug_action?
        root(action: :show, controller: :root, as: :auth)
      end
    end
    subclass
  end
end