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.
9 10 11 12 13 14 |
# File 'lib/arproxy/config.rb', line 9 def initialize @proxies = [] if defined?(Rails) @adapter = Rails.application.config_for(:database)["adapter"] end end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/arproxy/config.rb', line 6 def adapter @adapter end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/arproxy/config.rb', line 6 def logger @logger end |
#proxies ⇒ Object (readonly)
Returns the value of attribute proxies.
7 8 9 |
# File 'lib/arproxy/config.rb', line 7 def proxies @proxies end |
Instance Method Details
#adapter_class ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/arproxy/config.rb', line 26 def adapter_class raise Arproxy::Error, "config.adapter must be set" unless @adapter case @adapter when String, Symbol eval "::ActiveRecord::ConnectionAdapters::#{camelized_adapter_name}Adapter" when Class @adapter else raise Arproxy::Error, "unexpected config.adapter: #{@adapter}" end end |