Sha256: bad2fdf2ea484f3d27d2da2599623a8790eec396209ecb3ede210781b7e32302

Contents?: true

Size: 479 Bytes

Versions: 25

Compression:

Stored size: 479 Bytes

Contents

#
# This router will load the tenant name based on a request's sub-domain
#

module Penthouse
  module Routers
    class SubdomainRouter < BaseRouter

      # Determines the tenant identifier based on the sub-domain of the request
      # @param request [Rack::Request] The request from the Rack app, used to determine the tenant
      # @return [String, Symbol] A tenant identifier
      def self.call(request)
        request.host.split(".").first
      end

    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
penthouse-0.4.1 lib/penthouse/routers/subdomain_router.rb
penthouse-0.4.0 lib/penthouse/routers/subdomain_router.rb
penthouse-0.3.0 lib/penthouse/routers/subdomain_router.rb
penthouse-0.2.0 lib/penthouse/routers/subdomain_router.rb
penthouse-0.1.0 lib/penthouse/routers/subdomain_router.rb