Class: ActualDbSchema::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/actual_db_schema/configuration.rb

Overview

Manages the configuration settings for the gem.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
# File 'lib/actual_db_schema/configuration.rb', line 9

def initialize
  @enabled = Rails.env.development?
  @auto_rollback_disabled = ENV["ACTUAL_DB_SCHEMA_AUTO_ROLLBACK_DISABLED"].present?
  @ui_enabled = Rails.env.development? || ENV["ACTUAL_DB_SCHEMA_UI_ENABLED"].present?
  @git_hooks_enabled = ENV["ACTUAL_DB_SCHEMA_GIT_HOOKS_ENABLED"].present?
  @multi_tenant_schemas = nil
  @console_migrations_enabled = ENV["ACTUAL_DB_SCHEMA_CONSOLE_MIGRATIONS_ENABLED"].present?
  @migrated_folder = ENV["ACTUAL_DB_SCHEMA_MIGRATED_FOLDER"].present?
end

Instance Attribute Details

#auto_rollback_disabledObject

Returns the value of attribute auto_rollback_disabled.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def auto_rollback_disabled
  @auto_rollback_disabled
end

#console_migrations_enabledObject

Returns the value of attribute console_migrations_enabled.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def console_migrations_enabled
  @console_migrations_enabled
end

#enabledObject

Returns the value of attribute enabled.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def enabled
  @enabled
end

#git_hooks_enabledObject

Returns the value of attribute git_hooks_enabled.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def git_hooks_enabled
  @git_hooks_enabled
end

#migrated_folderObject

Returns the value of attribute migrated_folder.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def migrated_folder
  @migrated_folder
end

#multi_tenant_schemasObject

Returns the value of attribute multi_tenant_schemas.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def multi_tenant_schemas
  @multi_tenant_schemas
end

#ui_enabledObject

Returns the value of attribute ui_enabled.



6
7
8
# File 'lib/actual_db_schema/configuration.rb', line 6

def ui_enabled
  @ui_enabled
end

Instance Method Details

#[](key) ⇒ Object



19
20
21
# File 'lib/actual_db_schema/configuration.rb', line 19

def [](key)
  public_send(key)
end

#[]=(key, value) ⇒ Object



23
24
25
# File 'lib/actual_db_schema/configuration.rb', line 23

def []=(key, value)
  public_send("#{key}=", value)
end

#fetch(key, default = nil) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/actual_db_schema/configuration.rb', line 27

def fetch(key, default = nil)
  if respond_to?(key)
    public_send(key)
  else
    default
  end
end