Class: Innkeeper::Elevators::Subdomain
- Inherits:
-
Generic
- Object
- Generic
- Innkeeper::Elevators::Subdomain
show all
- Defined in:
- lib/innkeeper/elevators/subdomain.rb
Overview
Provides a rack based tenant switching solution based on subdomains
Assumes that tenant name should match subdomain
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generic
#call, #initialize
Class Method Details
.excluded_subdomains ⇒ Object
10
11
12
|
# File 'lib/innkeeper/elevators/subdomain.rb', line 10
def self.excluded_subdomains
@excluded_subdomains ||= []
end
|
.excluded_subdomains=(arg) ⇒ Object
14
15
16
|
# File 'lib/innkeeper/elevators/subdomain.rb', line 14
def self.excluded_subdomains=(arg)
@excluded_subdomains = arg
end
|
Instance Method Details
#parse_tenant_name(request) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/innkeeper/elevators/subdomain.rb', line 18
def parse_tenant_name(request)
request_subdomain = subdomain(request.host)
tenant = if self.class.excluded_subdomains.include?(request_subdomain)
nil
else
request_subdomain
end
tenant.presence
end
|