Class: Flatrack::DomainParser

Inherits:
Struct
  • Object
show all
Defined in:
lib/flatrack/domain_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



2
3
4
# File 'lib/flatrack/domain_parser.rb', line 2

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/flatrack/domain_parser.rb', line 4

def call(env)
  *subdomains, host, tld = env['SERVER_NAME'].split '.'
  env['domain.sub']      = subdomains.join '.'
  env['domain.host']     = host
  env['domain.tld']      = tld
  app.call(env)
end