Sha256: 7a25f0b0bd9624711630faa35f454289eee6872c53440eae0fbd5951562126f3
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
# # This class provides an abstract for the tenant interface. Whilst any Proc # could be used, it's safest for people to sub-class to ensure that any future # interface changes are catered for. # # A tenant class's responsibility is to receive a block, around which it should # handle switching to the given tenant's configuration, ensuring that if an # exception occurs, the configuration is reset back to the global configuration. # module Penthouse module Tenants class BaseTenant attr_accessor :identifier private :identifier= # @param identifier [String, Symbol] An identifier for the tenant def initialize(identifier:, **args) self.identifier = identifier end # @abstract placeholder for the relevant tenant-switching code # @param block [Block] The code to execute within the tenant # @yield [BaseTenant] The current tenant instance # @return [void] def call(&block) raise NotImplementedError end # @abstract creates the tenant data store # @return [void] def create(*) raise NotImplementedError end # @abstract deletes the tenant data store # @return [void] def delete(*) raise NotImplementedError end end end end
Version data entries
6 entries across 6 versions & 1 rubygems