Sha256: 7ee31a41f961c649e82fbbb27aca0c76a4f0c3228a170b90ac6583a1bf4d0d31

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

#
# The Penthouse::Configuration class contains all configuration options for
# Penthouse, such as which router to use.
#
# @example
#   Penthouse.configure do |config|
#     config.router = Penthouse::Routers::BaseRouter
#     config.runner = Penthouse::Runners::BaseRunner
#     config
#   end
#

module Penthouse
  class Configuration
    attr_accessor :router, :runner, :migrate_tenants, :tenant_identifiers

    # @param router [Penthouse::Routers::BaseRouter] the default router for your application to use
    # @param runner [Penthouse::Runners::BaseRunner] the default runner for your application to use
    # @param migrate_tenants [Boolean] whether you want Penthouse to automatically migrate all tenants
    # @param tenant_identifiers [Proc] some code which must return an array of tenant identifiers (strings/symbols)
    def initialize(router: nil, runner: nil, migrate_tenants: false, tenant_identifiers: -> { raise NotImplementedError })
      self.router = router
      self.runner = runner
      self.migrate_tenants = migrate_tenants
      self.tenant_identifiers = tenant_identifiers
    end

    # @return [Boolean] whether or not Penthouse should automatically migrate all tenants
    def migrate_tenants?
      !!migrate_tenants
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
penthouse-0.2.0 lib/penthouse/configuration.rb