Created
April 16, 2017 03:33
-
-
Save he-and-her/5bfbfc089eed4aba5e05b49893adc559 to your computer and use it in GitHub Desktop.
handle_options method from action_dispatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_options(options) #:nodoc: | |
options[:path] ||= "/" | |
if options[:domain] == :all || options[:domain] == "all" | |
domain_regexp = options[:tld_length] ? /([^.]+\.?){#{options[:tld_length]}}$/ : DOMAIN_REGEXP | |
options[:domain] = if (request.host !~ /^[\d.]+$/) && (request.host =~ domain_regexp) | |
".#{$&}" | |
end | |
elsif options[:domain].is_a? Array | |
options[:domain] = options[:domain].find { |domain| request.host.include? domain.sub(/^\./, "") } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment