Class: Noiseless::Configuration
- Inherits:
-
Object
- Object
- Noiseless::Configuration
- Defined in:
- lib/noiseless.rb
Instance Attribute Summary collapse
-
#auto_index ⇒ Object
Global kill switch for model auto-indexing callbacks.
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#connections_config ⇒ Object
Returns the value of attribute connections_config.
-
#default_adapter ⇒ Object
Returns the value of attribute default_adapter.
-
#default_connection ⇒ Object
Returns the value of attribute default_connection.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/noiseless.rb', line 50 def initialize @connections_config = {} @default_connection = :primary @default_adapter = :opensearch @auto_index = ENV.fetch("NOISELESS_AUTO_INDEX", "true") != "false" @config_path = lambda do if defined?(Rails) && Rails.respond_to?(:root) && Rails.root Rails.root.join("config/noiseless.yml") else File.("config/noiseless.yml", Dir.pwd) end end end |
Instance Attribute Details
#auto_index ⇒ Object
Global kill switch for model auto-indexing callbacks. Lets environments without a search backend (e.g. CI) run without connection-error noise on every save. Defaults to NOISELESS_AUTO_INDEX env var, on unless "false".
48 49 50 |
# File 'lib/noiseless.rb', line 48 def auto_index @auto_index end |
#config_path ⇒ Object
Returns the value of attribute config_path.
44 45 46 |
# File 'lib/noiseless.rb', line 44 def config_path @config_path end |
#connections_config ⇒ Object
Returns the value of attribute connections_config.
44 45 46 |
# File 'lib/noiseless.rb', line 44 def connections_config @connections_config end |
#default_adapter ⇒ Object
Returns the value of attribute default_adapter.
44 45 46 |
# File 'lib/noiseless.rb', line 44 def default_adapter @default_adapter end |
#default_connection ⇒ Object
Returns the value of attribute default_connection.
44 45 46 |
# File 'lib/noiseless.rb', line 44 def default_connection @default_connection end |