Class: ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver
- Defined in:
- activerecord/lib/active_record/connection_adapters/connection_specification.rb
Overview
Builds a ConnectionSpecification from user input
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#configurations ⇒ Object
readonly
Returns the value of attribute configurations.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
-
#initialize(config, configurations) ⇒ Resolver
constructor
A new instance of Resolver.
- #spec ⇒ Object
Constructor Details
#initialize(config, configurations) ⇒ Resolver
Returns a new instance of Resolver.
21 22 23 24 |
# File 'activerecord/lib/active_record/connection_adapters/connection_specification.rb', line 21 def initialize(config, configurations) @config = config @configurations = configurations end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config
19 20 21 |
# File 'activerecord/lib/active_record/connection_adapters/connection_specification.rb', line 19 def config @config end |
#configurations ⇒ Object (readonly)
Returns the value of attribute configurations
19 20 21 |
# File 'activerecord/lib/active_record/connection_adapters/connection_specification.rb', line 19 def configurations @configurations end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass
19 20 21 |
# File 'activerecord/lib/active_record/connection_adapters/connection_specification.rb', line 19 def klass @klass end |
Instance Method Details
#spec ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'activerecord/lib/active_record/connection_adapters/connection_specification.rb', line 26 def spec case config when nil raise AdapterNotSpecified unless defined?(Rails.env) resolve_string_connection Rails.env when Symbol, String resolve_string_connection config.to_s when Hash resolve_hash_connection config end end |