Class: IuguSDK::RootTenancyUrl
- Inherits:
-
Object
- Object
- IuguSDK::RootTenancyUrl
- Defined in:
- lib/iugusdk/root_tenancy_url.rb
Class Method Summary collapse
-
.matches?(request) ⇒ Boolean
matches?
will check a request.host against a set of invalid urls.
Class Method Details
.matches?(request) ⇒ Boolean
matches?
will check a request.host against a set of invalid urls
-
Args:
-
request
-> An ActionDispatch::Request object
-
-
Success
-
Return true if request.host is found in the invalid array
-
-
False
-
Return true if request.host is not found in the invalid array
-
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/iugusdk/root_tenancy_url.rb', line 15 def self.matches?(request) application_domain = IuguSDK::application_main_host application_domain = application_domain.gsub('.dev','') valids = [ application_domain, ['www.',application_domain].join, 'localhost' ] normalized_host = request.host.gsub('.dev','') unless Rails.env.production? return true if normalized_host.match("#{application_domain}\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.xip.io") end valids.include?( normalized_host ) end |