Class: ActiveRecord::DatabaseConfigurations::DatabaseConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/database_configurations/database_config.rb

Overview

ActiveRecord::Base.configurations will return either a HashConfig or UrlConfig respectively. It will never return a DatabaseConfig object, as this is the parent class for the types of database configuration objects.

Direct Known Subclasses

HashConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env_name, name) ⇒ DatabaseConfig

Returns a new instance of DatabaseConfig.



11
12
13
14
15
# File 'lib/active_record/database_configurations/database_config.rb', line 11

def initialize(env_name, name)
  @env_name = env_name
  @name = name
  @adapter_class = nil
end

Instance Attribute Details

#env_nameObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/database_configurations/database_config.rb', line 9

def env_name
  @env_name
end

#nameObject (readonly)

:nodoc:



9
10
11
# File 'lib/active_record/database_configurations/database_config.rb', line 9

def name
  @name
end

Instance Method Details

#_database=(database) ⇒ Object

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/active_record/database_configurations/database_config.rb', line 43

def _database=(database)
  raise NotImplementedError
end

#adapterObject

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/active_record/database_configurations/database_config.rb', line 47

def adapter
  raise NotImplementedError
end

#adapter_classObject



17
18
19
# File 'lib/active_record/database_configurations/database_config.rb', line 17

def adapter_class
  @adapter_class ||= ActiveRecord::ConnectionAdapters.resolve(adapter)
end

#checkout_timeoutObject

Raises:

  • (NotImplementedError)


71
72
73
# File 'lib/active_record/database_configurations/database_config.rb', line 71

def checkout_timeout
  raise NotImplementedError
end

#databaseObject

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/active_record/database_configurations/database_config.rb', line 39

def database
  raise NotImplementedError
end

#for_current_env?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/active_record/database_configurations/database_config.rb', line 91

def for_current_env?
  env_name == ActiveRecord::ConnectionHandling::DEFAULT_ENV.call
end

#hostObject

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/active_record/database_configurations/database_config.rb', line 35

def host
  raise NotImplementedError
end

#idle_timeoutObject

Raises:

  • (NotImplementedError)


79
80
81
# File 'lib/active_record/database_configurations/database_config.rb', line 79

def idle_timeout
  raise NotImplementedError
end

#inspectObject

:nodoc:



21
22
23
# File 'lib/active_record/database_configurations/database_config.rb', line 21

def inspect # :nodoc:
  "#<#{self.class.name} env_name=#{@env_name} name=#{@name} adapter_class=#{adapter_class}>"
end

#max_queueObject

Raises:

  • (NotImplementedError)


63
64
65
# File 'lib/active_record/database_configurations/database_config.rb', line 63

def max_queue
  raise NotImplementedError
end

#max_threadsObject

Raises:

  • (NotImplementedError)


59
60
61
# File 'lib/active_record/database_configurations/database_config.rb', line 59

def max_threads
  raise NotImplementedError
end

#migrations_pathsObject

Raises:

  • (NotImplementedError)


87
88
89
# File 'lib/active_record/database_configurations/database_config.rb', line 87

def migrations_paths
  raise NotImplementedError
end

#min_threadsObject

Raises:

  • (NotImplementedError)


55
56
57
# File 'lib/active_record/database_configurations/database_config.rb', line 55

def min_threads
  raise NotImplementedError
end

#new_connectionObject



25
26
27
# File 'lib/active_record/database_configurations/database_config.rb', line 25

def new_connection
  adapter_class.new(configuration_hash)
end

#poolObject

Raises:

  • (NotImplementedError)


51
52
53
# File 'lib/active_record/database_configurations/database_config.rb', line 51

def pool
  raise NotImplementedError
end

#query_cacheObject

Raises:

  • (NotImplementedError)


67
68
69
# File 'lib/active_record/database_configurations/database_config.rb', line 67

def query_cache
  raise NotImplementedError
end

#reaping_frequencyObject

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/active_record/database_configurations/database_config.rb', line 75

def reaping_frequency
  raise NotImplementedError
end

#replica?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


83
84
85
# File 'lib/active_record/database_configurations/database_config.rb', line 83

def replica?
  raise NotImplementedError
end

#schema_cache_pathObject

Raises:

  • (NotImplementedError)


95
96
97
# File 'lib/active_record/database_configurations/database_config.rb', line 95

def schema_cache_path
  raise NotImplementedError
end

#use_metadata_table?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


99
100
101
# File 'lib/active_record/database_configurations/database_config.rb', line 99

def 
  raise NotImplementedError
end

#validate!Object



29
30
31
32
33
# File 'lib/active_record/database_configurations/database_config.rb', line 29

def validate!
  adapter_class if adapter

  true
end