Sha256: fc9d39f9d5280e065e554adba351903f8fb1e537996fa31a9fd9ab859f1f25fe

Contents?: true

Size: 426 Bytes

Versions: 4

Compression:

Stored size: 426 Bytes

Contents

module RatPack
  module Routes
    def subdomains(tld_len=1) # we set tld_len to 1, use 2 for co.uk or similar
      subdomain_regex = /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/  
      @subdomains ||= if (request.host.nil? ||subdomain_regex.match(request.host))
                        request.host.split('.')[0...(1 - tld_len - 2)]
                      else
                        []
                      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
BrianTheCoder-ratpack-0.2.2 lib/ratpack/routes.rb
BrianTheCoder-ratpack-0.2.3 lib/ratpack/routes.rb
BrianTheCoder-ratpack-0.2.4 lib/ratpack/routes.rb
BrianTheCoder-ratpack-0.3.1 lib/ratpack/routes.rb