Class: SubdomainMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/subdomain_matcher.rb

Class Method Summary collapse

Class Method Details

.to_domain(request) ⇒ Object



3
4
5
6
7
# File 'lib/subdomain_matcher.rb', line 3

def self.to_domain(request)
  first_sub_domain = request.host.split('.').first
  # disallow any non alphabetic chars!
  domain = first_sub_domain.upcase if first_sub_domain.match(/\A[a-zA-Z0-9]*\z/)
end