Class: Penthouse::Configuration
- Inherits:
-
Object
- Object
- Penthouse::Configuration
- Defined in:
- lib/penthouse/configuration.rb
Instance Attribute Summary collapse
-
#db_schema_file ⇒ Object
Returns the value of attribute db_schema_file.
-
#migrate_tenants ⇒ Object
Returns the value of attribute migrate_tenants.
-
#router ⇒ Object
Returns the value of attribute router.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#tenants ⇒ Object
Returns the value of attribute tenants.
Instance Method Summary collapse
-
#initialize(router: nil, runner: nil, migrate_tenants: false, db_schema_file: nil, tenants: -> { raise NotImplementedError }) ⇒ Configuration
constructor
A new instance of Configuration.
-
#migrate_tenants? ⇒ Boolean
Whether or not Penthouse should automatically migrate all tenants.
Constructor Details
#initialize(router: nil, runner: nil, migrate_tenants: false, db_schema_file: nil, tenants: -> { raise NotImplementedError }) ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/penthouse/configuration.rb', line 24 def initialize(router: nil, runner: nil, migrate_tenants: false, db_schema_file: nil, tenants: -> { raise NotImplementedError }) self.router = router self.runner = runner self.migrate_tenants = migrate_tenants self.db_schema_file = db_schema_file self.tenants = tenants if migrate_tenants? && !db_schema_file raise ArgumentError, "If you want to migrate tenants, we need a path to a DB schema file" elsif migrate_tenants? && !File.exist?(db_schema_file) raise ArgumentError, "#{db_schema_file} is not readable" end end |
Instance Attribute Details
#db_schema_file ⇒ Object
Returns the value of attribute db_schema_file.
15 16 17 |
# File 'lib/penthouse/configuration.rb', line 15 def db_schema_file @db_schema_file end |
#migrate_tenants ⇒ Object
Returns the value of attribute migrate_tenants.
15 16 17 |
# File 'lib/penthouse/configuration.rb', line 15 def migrate_tenants @migrate_tenants end |
#router ⇒ Object
Returns the value of attribute router.
15 16 17 |
# File 'lib/penthouse/configuration.rb', line 15 def router @router end |
#runner ⇒ Object
Returns the value of attribute runner.
15 16 17 |
# File 'lib/penthouse/configuration.rb', line 15 def runner @runner end |
#tenants ⇒ Object
Returns the value of attribute tenants.
15 16 17 |
# File 'lib/penthouse/configuration.rb', line 15 def tenants @tenants end |
Instance Method Details
#migrate_tenants? ⇒ Boolean
Returns whether or not Penthouse should automatically migrate all tenants.
39 40 41 |
# File 'lib/penthouse/configuration.rb', line 39 def migrate_tenants? !!migrate_tenants end |