Class: Subdomainitis::MainDomainRouteSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent_route_set) ⇒ MainDomainRouteSet

Returns a new instance of MainDomainRouteSet.



55
56
57
58
# File 'lib/subdomainitis.rb', line 55

def initialize(parent_route_set)
  @parent_route_set = parent_route_set
  super *[]
end

Instance Attribute Details

#parent_route_setObject (readonly)

Returns the value of attribute parent_route_set.



59
60
61
# File 'lib/subdomainitis.rb', line 59

def parent_route_set
  @parent_route_set
end

Instance Method Details

#add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true) ⇒ Object



61
62
63
64
# File 'lib/subdomainitis.rb', line 61

def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true)
  parent_route_set.add_maindomain_route name
  parent_route_set.add_route wrap(app), conditions, requirements, defaults, name, anchor
end

#wrap(app) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/subdomainitis.rb', line 65

def wrap(app)
  ActionDispatch::Routing::Mapper::Constraints.new(
    app,
    [IsMaindomain.new(parent_route_set)],
    request_class
  )
end