Sha256: cb6c5639ca47013744c5abe565814e6ed06029fa112804265e6b38b3785b1275
Contents?: true
Size: 583 Bytes
Versions: 12
Compression:
Stored size: 583 Bytes
Contents
require 'apartment/elevators/generic' module Apartment module Elevators # Provides a rack based tenant switching solution based on hosts # Uses a hash to find the corresponding tenant name for the host # class HostHash < Generic def initialize(app, hash = {}, processor = nil) super app, processor @hash = hash end def parse_tenant_name(request) raise TenantNotFound, "Cannot find tenant for host #{request.host}" unless @hash.has_key?(request.host) @hash[request.host] end end end end
Version data entries
12 entries across 12 versions & 2 rubygems