Class: Arproxy::Config
- Inherits:
-
Object
- Object
- Arproxy::Config
- Defined in:
- lib/arproxy/config.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#proxies ⇒ Object
readonly
Returns the value of attribute proxies.
Instance Method Summary collapse
- #adapter_class ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #plugin(name, *options) ⇒ Object
- #use(proxy_class, *options) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 |
# File 'lib/arproxy/config.rb', line 6 def initialize @proxies = [] end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
3 4 5 |
# File 'lib/arproxy/config.rb', line 3 def adapter @adapter end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/arproxy/config.rb', line 3 def logger @logger end |
#proxies ⇒ Object (readonly)
Returns the value of attribute proxies.
4 5 6 |
# File 'lib/arproxy/config.rb', line 4 def proxies @proxies end |
Instance Method Details
#adapter_class ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/arproxy/config.rb', line 20 def adapter_class raise Arproxy::Error, "config.adapter must be set" unless @adapter case @adapter when String, Symbol camelized_adapter_name = @adapter.to_s.split("_").map(&:capitalize).join eval "::ActiveRecord::ConnectionAdapters::#{camelized_adapter_name}Adapter" when Class @adapter else raise Arproxy::Error, "unexpected config.adapter: #{@adapter}" end end |