lib/apartment/elevators/host_hash.rb in ros-apartment-2.3.0 vs lib/apartment/elevators/host_hash.rb in ros-apartment-2.4.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'apartment/elevators/generic' module Apartment module Elevators # Provides a rack based tenant switching solution based on hosts @@ -10,11 +12,13 @@ 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) + unless @hash.key?(request.host) + raise TenantNotFound, + "Cannot find tenant for host #{request.host}" + end @hash[request.host] end end end