lib/penthouse.rb in penthouse-0.11.0 vs lib/penthouse.rb in penthouse-0.12.0
- old
+ new
@@ -27,11 +27,11 @@
# @param tenant_identifier [String, Symbol] the identifier for the tenant
# @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 with_tenant(tenant_identifier, default_tenant: self.tenant, &block)
+ def with_tenant(tenant_identifier:, default_tenant: self.tenant, &block)
self.tenant = tenant_identifier
block.yield(tenant_identifier)
ensure
self.tenant = default_tenant
end
@@ -43,39 +43,39 @@
# @param block [Block] the code to execute
# @yield [String, Symbol] the identifier for the tenant
# @return [void]
def each_tenant(tenant_identifiers: self.tenant_identifiers, runner: self.configuration.runner, &block)
tenant_identifiers.each do |tenant_identifier|
- switch(tenant_identifier, runner: runner, &block)
+ switch(tenant_identifier: tenant_identifier, runner: runner, &block)
end
end
# Executes the given block of code within a given tenant
# @param tenant_identifier [String, Symbol] the identifier for the tenant
# @param runner [Penthouse::Runners::BaseRunner] an optional runner to use, defaults to the one configured
# @param block [Block] the code to execute
# @yield [Penthouse::Tenants::BaseTenant] the tenant instance
# @return [void]
- def switch(tenant_identifier, runner: self.configuration.runner, &block)
- runner.call(tenant_identifier, &block)
+ def switch(tenant_identifier:, runner: self.configuration.runner, &block)
+ runner.call(tenant_identifier: tenant_identifier, &block)
end
# Loads the tenant and creates their data store
# @param tenant_identifier [String, Symbol] the identifier for the tenant
# @see Penthouse::Tenants::BaseTenant#delete
# @return [void]
- def create(tenant_identifier, runner: self.configuration.runner, **options)
- switch(tenant_identifier, runner: runner) do |tenant|
+ def create(tenant_identifier:, runner: self.configuration.runner, **options)
+ switch(tenant_identifier: tenant_identifier, runner: runner) do |tenant|
tenant.create(**options)
end
end
# Loads the tenant and deletes their data store
# @param tenant_identifier [String, Symbol] the identifier for the tenant
# @see Penthouse::Tenants::BaseTenant#delete
# @return [void]
- def delete(tenant_identifier, runner: self.configuration.runner, **options)
- switch(tenant_identifier, runner: runner) do |tenant|
+ def delete(tenant_identifier:, runner: self.configuration.runner, **options)
+ switch(tenant_identifier: tenant_identifier, runner: runner) do |tenant|
tenant.delete(**options)
end
end
# Allows you to configure the router of Penthouse