Module: Deimos::Configurable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Deimos
- Defined in:
- lib/deimos/config/configurable.rb
Overview
Module to allow configuration. Loosely based off of the dry-configuration gem but with several advantages:
-
Works with Ruby 2.3.
-
More succinct syntax using method_missing so you do not need to write “config.whatever” and can just write “whatever”.
-
Use nested blocks: Deimos.configure do
config.kafka.ssl do enabled true ca_cert_file 'my_file' endend
-
Allows for arrays of configurations: Deimos.configure do |config|
config.producer do class_name 'MyProducer' topic 'MyTopic' endend
-
Allows to call
configuremultiple times without crashing. -
Allows to lazy-set default values by passing a proc as a default:
Deimos.define_settings do |config|
setting :my_val, default_proc: proc { MyDefault.calculated_value }
end
-
Support for setting up and automatically calling deprecated configurations.
-
Support for configuration callbacks.
Defined Under Namespace
Modules: ClassMethods Classes: ConfigStruct, ConfigValue