Class: Subdomainitis::IsSubdomain

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

Direct Known Subclasses

IsMaindomain

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route_set) ⇒ IsSubdomain

Returns a new instance of IsSubdomain.



7
8
9
# File 'lib/subdomainitis.rb', line 7

def initialize(route_set)
  @route_set = route_set
end

Instance Attribute Details

#route_setObject (readonly)

Returns the value of attribute route_set.



10
11
12
# File 'lib/subdomainitis.rb', line 10

def route_set
  @route_set
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# File 'lib/subdomainitis.rb', line 14

def matches?(request)
  if use_fake_subdomains
    request.GET.has_key?(SUBDOMAIN_KEY)
  else
    request.subdomain(tld_length).present?
  end
end