class Configurate::Settings
This is your main entry point. Instead of lengthy explanations let an example demonstrate its usage:
require 'configuration_methods' AppSettings = Configurate::Settings.create do add_provider Configurate::Provider::Env add_provider Configurate::Provider::YAML, '/etc/app_settings.yml', namespace: Rails.env, required: false add_provider Configurate::Provider::YAML, 'config/default_settings.yml' extend YourConfigurationMethods end AppSettings.setup_something if AppSettings.something.enable?
Please also read the note at {Proxy}!
Attributes
lookup_chain[R]
Public Class Methods
create(&block)
click to toggle source
Create a new configuration object @yield the given block will be evaluated in the context of the new object
# File lib/configurate.rb, line 73 def self.create(&block) config = new config.instance_eval(&block) if block_given? config end
new()
click to toggle source
# File lib/configurate.rb, line 46 def initialize @lookup_chain = LookupChain.new warn "Warning you called Configurate::Settings.new with a block, you really meant to call #create" if block_given? end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
See description and {#lookup}, {#[]} and {#add_provider}
# File lib/configurate.rb, line 66 def method_missing(method, *args, &block) Proxy.new(@lookup_chain).public_send(method, *args, &block) end