lib/penthouse.rb in penthouse-0.6.0 vs lib/penthouse.rb in penthouse-0.7.0

- old
+ new

@@ -1,6 +1,6 @@ -require "penthouse/railtie" if defined?(Rails) +require "penthouse/migrator" require "penthouse/version" require "penthouse/configuration" require "penthouse/routers/base_router" require "penthouse/runners/base_runner" @@ -35,15 +35,16 @@ self.tenant = default_tenant end # Wraps Penthouse.switch and simply executes the block of code for each # tenant within Penthouse.tenant_identifiers + # @param tenant_identifiers [Array<String, Symbol>, nil] the array of tenants to loop through # @param default_tenant [String, Symbol] the identifier for the tenant to return to # @param block [Block] the code to execute # @yield [String, Symbol] the identifier for the tenant # @return [void] - def each_tenant(default_tenant: tenant, runner: configuration.runner, &block) - tenant_identifiers.each do |tenant_identifier| + def each_tenant(tenant_identifiers: nil, default_tenant: tenant, runner: configuration.runner, &block) + (tenant_identifiers || self.tenant_identifiers).each do |tenant_identifier| switch(tenant_identifier, runner: runner, &block) end end # Executes the given block of code within a given tenant