Class: Apartment::Elevators::FirstSubdomain

Inherits:
Subdomain show all
Defined in:
lib/apartment/elevators/first_subdomain.rb

Overview

Tenant from the first segment of nested subdomains. acme.staging.example.com -> acme

Instance Method Summary collapse

Methods inherited from Subdomain

#initialize

Methods inherited from Generic

#call, #initialize

Constructor Details

This class inherits a constructor from Apartment::Elevators::Subdomain

Instance Method Details

#parse_tenant_name(request) ⇒ Object



10
11
12
13
14
15
# File 'lib/apartment/elevators/first_subdomain.rb', line 10

def parse_tenant_name(request)
  tenant = super
  return nil if tenant.nil?

  tenant.split('.').first
end