Class: SlavePools::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/slave_pools/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



16
17
18
19
20
# File 'lib/slave_pools/config.rb', line 16

def initialize
  @environment        = 'development'
  @defaults_to_master = false
  @safe_methods       = []
end

Instance Attribute Details

#defaults_to_masterObject

When true, all queries will go to master unless wrapped in with_pool{}. When false, all safe queries will go to the current replica unless wrapped in with_master{}. Defaults to false.



10
11
12
# File 'lib/slave_pools/config.rb', line 10

def defaults_to_master
  @defaults_to_master
end

#environmentObject

The current environment. Normally set to Rails.env, but will default to ‘development’ outside of Rails apps.



5
6
7
# File 'lib/slave_pools/config.rb', line 5

def environment
  @environment
end

#safe_methodsObject

The list of methods considered safe to send to a readonly connection. Defaults are based on Rails version.



14
15
16
# File 'lib/slave_pools/config.rb', line 14

def safe_methods
  @safe_methods
end