Class: Rack::MultiTenant::TenantStrategies::Port
- Inherits:
-
Object
- Object
- Rack::MultiTenant::TenantStrategies::Port
- Defined in:
- lib/rack/multitenant/tenant_strategies/port.rb
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(port_map) ⇒ Port
constructor
port_map: A hash of ports to tenants.
Constructor Details
#initialize(port_map) ⇒ Port
port_map: A hash of ports to tenants
>> require "ostruct"
>> ports = {3000 => :foo, 3001 => :bar}
>> req = OpenStruct.new(port: 3001)
>> s = Rack::MultiTenant::TenantStrategies::Port.new(ports)
>> s.call(req)
=> :bar
11 12 13 |
# File 'lib/rack/multitenant/tenant_strategies/port.rb', line 11 def initialize(port_map) @port_map = port_map end |
Instance Method Details
#call(request) ⇒ Object
15 16 17 |
# File 'lib/rack/multitenant/tenant_strategies/port.rb', line 15 def call(request) tenant = @port_map[request.port] end |