Class Configatron
In: lib/configatron/configatron.rb
lib/configatron/errors.rb
lib/configatron/proc.rb
lib/configatron/rails.rb
lib/configatron/store.rb
Parent: Object

Methods

Included Modules

Singleton

Classes and Modules

Module Configatron::Rails
Class Configatron::Delayed
Class Configatron::Dynamic
Class Configatron::LockedNamespace
Class Configatron::Proc
Class Configatron::ProtectedParameter
Class Configatron::Store

External Aliases

send -> send!

Public Instance methods

Forwards the method call onto the ‘namespaced’ Configatron::Store

[Source]

    # File lib/configatron/configatron.rb, line 14
14:   def method_missing(sym, *args)
15:     @_store[@_namespace.last].send(sym, *args)
16:   end

Removes ALL configuration parameters

[Source]

    # File lib/configatron/configatron.rb, line 19
19:   def reset!
20:     @_store = {:default => Configatron::Store.new}
21:   end

Allows for the temporary overriding of parameters in a block. Takes an optional Hash of parameters that will be applied before the block gets called. At the end of the block, the temporary settings are deleted and the original settings are reinstated.

[Source]

    # File lib/configatron/configatron.rb, line 27
27:   def temp(options = nil)
28:     begin
29:       temp_start(options)
30:       yield
31:     rescue Exception => e
32:       raise e
33:     ensure
34:       temp_end
35:     end
36:   end

[Source]

    # File lib/configatron/configatron.rb, line 47
47:   def temp_end
48:     @_store.delete(@_namespace.pop)
49:   end

[Source]

    # File lib/configatron/configatron.rb, line 38
38:   def temp_start(options = nil)
39:     n_space = rand
40:     @_store[n_space] = @_store[@_namespace.last].deep_clone
41:     @_namespace << n_space
42:     if options
43:       self.method_missing(:configure_from_hash, options)
44:     end
45:   end

[Validate]