Sha256: 97d47a7e60886ed18b3af427baf4dff6900aac1b215b246e728e2f5eed81a601

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

# RootTenancyUrl will lookup configuration hash and

# TODO: Write Tests (PN)
module IuguSDK
  class RootTenancyUrl

    # +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
    def self.matches?(request)
      application_domain = IuguSDK::application_main_host
      valids = [ application_domain, ['www.',application_domain].join, 'localhost' ]
      unless Rails.env.production?
        # first_part_uri = application_domain.gsub('.dev','')
        return true if request.host.match("#{application_domain}\.[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+\.xip.io")
      end
      valids.include?( request.host )
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.5 lib/iugusdk/root_tenancy_url.rb
iugusdk-1.0.0.alpha.4 lib/iugusdk/root_tenancy_url.rb