<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/configatron/proc.rb</filename>
    </added>
    <added>
      <filename>spec/configatron/delayed_spec.rb</filename>
    </added>
    <added>
      <filename>spec/configatron/dynamic_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -104,31 +104,7 @@ Of course you can update a single parameter n levels deep as well:
   configatron.email.smtp.address # =&gt; &quot;smtp.example.com&quot;
 &lt;/code&gt;&lt;/pre&gt;
 
-h3. Misc.
-
-Even if parameters haven't been set, you can still call them, but you'll get a @Configatron::Store@ object back. The Configatron::Store class, however, will respond true to @.nil?@ if there are no parameters configured on it.
-
-&lt;pre&gt;&lt;code&gt;
-  configatron.i.dont.exist.nil? # =&gt; true
-  configatron.i.dont.exist # =&gt; Configatron::Store
-&lt;/code&gt;&lt;/pre&gt;
-
-If you want to get back an actual @nil@ then you can use the @retrieve@ method:
-
-&lt;pre&gt;&lt;code&gt;
-  configatron.i.do.exist = [:some, :array]
-  configatron.i.dont.retrieve(:exist, nil) # =&gt; nil
-  configatron.i.do.retrieve(:exist, :foo) # =&gt; [:some, :array]
-&lt;/code&gt;&lt;/pre&gt;
-
-You can set 'default' values for parameters. If there is already a setting, it won't be replaced. This is useful if you've already done your 'configuration' and you call a library, that needs to have parameters set. The library can set its defaults, without worrying that it might have overridden your custom settings.
-
-&lt;pre&gt;&lt;code&gt;
-  configatron.set_default(:name, 'Mark Bates')
-  configatron.name # =&gt; 'Mark Bates'
-  configatron.set_default(:name, 'Me')
-  configatron.name # =&gt; 'Mark Bates'
-&lt;/code&gt;&lt;/pre&gt;
+h3. Temp Configurations
 
 Sometimes in testing, or other situations, you want to temporarily change some settings. You can do this with the @temp@ method:
 
@@ -168,6 +144,82 @@ You can also pass in an optional Hash to the @temp@:
   configatron.letters.c # =&gt; nil
 &lt;/code&gt;&lt;/pre&gt;
 
+h3. Delayed and Dynamic Configurations
+
+There are times when you want to refer to one configuration setting in another configuration setting. Let's look at a fairly contrived example:
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.memcached.servers = ['127.0.0.1:11211']
+  configatron.page_caching.servers = configatron.memcached.servers
+  configatron.object_caching.servers = configatron.memcached.servers
+
+  if RAILS_ENV == 'production'
+    configatron.memcached.servers = ['192.168.0.1:11211']
+    configatron.page_caching.servers = configatron.memcached.servers
+    configatron.object_caching.servers = configatron.memcached.servers
+  elsif RAILS_ENV == 'staging'
+    configatron.memcached.servers = ['192.168.0.2:11211']
+    configatron.page_caching.servers = configatron.memcached.servers
+    configatron.object_caching.servers = configatron.memcached.servers
+  end
+&lt;/code&gt;&lt;/pre&gt;
+
+Now, we could've written that slightly differently, but it helps to illustrate the point. With Configatron you can create &lt;code&gt;Delayed&lt;/code&gt; and &lt;code&gt;Dynamic&lt;/code&gt; settings. 
+
+h4. Delayed
+
+With &lt;code&gt;Delayed&lt;/code&gt; settings execution of the setting doesn't happen until the first time it is executed. 
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.memcached.servers = ['127.0.0.1:11211']
+  configatron.page_caching.servers = Configatron::Delayed.new {configatron.memcached.servers}
+  configatron.object_caching.servers = Configatron::Delayed.new {configatron.memcached.servers}
+
+  if RAILS_ENV == 'production'
+    configatron.memcached.servers = ['192.168.0.1:11211']
+  elsif RAILS_ENV == 'staging'
+    configatron.memcached.servers = ['192.168.0.2:11211']
+  end
+&lt;/code&gt;&lt;/pre&gt;
+
+Execution occurs once and after that the result of that execution is returned. So in our case the first time someone calls the setting &lt;code&gt;configatron.page_caching.servers&lt;/code&gt; it will find the &lt;code&gt;configatron.memcached.servers&lt;/code&gt; setting and return that. After that point if the &lt;code&gt;configatron.memcached.servers&lt;/code&gt; setting is changed, the original settings are returned by &lt;code&gt;configatron.page_caching.servers&lt;/code&gt;.
+
+h4. Dynamic
+
+&lt;code&gt;Dynamic&lt;/code&gt; settings are very similar to &lt;code&gt;Delayed&lt;/code&gt; settings, but with one big difference. Every time you call a &lt;code&gt;Dynamic&lt;/code&gt; setting is executed. Take this example:
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.current.time = Configatron::Dynamic.new {Time.now}
+&lt;/code&gt;&lt;/pre&gt;
+
+Each time you call &lt;code&gt;configatron.current.time&lt;/code&gt; it will return a new value to you. While this seems a bit useless, it is pretty useful if you have ever changing configurations.
+
+h3. Misc.
+
+Even if parameters haven't been set, you can still call them, but you'll get a @Configatron::Store@ object back. The Configatron::Store class, however, will respond true to @.nil?@ if there are no parameters configured on it.
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.i.dont.exist.nil? # =&gt; true
+  configatron.i.dont.exist # =&gt; Configatron::Store
+&lt;/code&gt;&lt;/pre&gt;
+
+If you want to get back an actual @nil@ then you can use the @retrieve@ method:
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.i.do.exist = [:some, :array]
+  configatron.i.dont.retrieve(:exist, nil) # =&gt; nil
+  configatron.i.do.retrieve(:exist, :foo) # =&gt; [:some, :array]
+&lt;/code&gt;&lt;/pre&gt;
+
+You can set 'default' values for parameters. If there is already a setting, it won't be replaced. This is useful if you've already done your 'configuration' and you call a library, that needs to have parameters set. The library can set its defaults, without worrying that it might have overridden your custom settings.
+
+&lt;pre&gt;&lt;code&gt;
+  configatron.set_default(:name, 'Mark Bates')
+  configatron.name # =&gt; 'Mark Bates'
+  configatron.set_default(:name, 'Me')
+  configatron.name # =&gt; 'Mark Bates'
+&lt;/code&gt;&lt;/pre&gt;
+
 Enjoy!
 
 h2. Contact</diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 
 Gem::Specification.new do |s|
   s.name = %q{configatron}
-  s.version = &quot;2.4.2.20090909140253&quot;
+  s.version = &quot;2.4.2.20090909154619&quot;
 
   s.required_rubygems_version = Gem::Requirement.new(&quot;&gt;= 0&quot;) if s.respond_to? :required_rubygems_version=
   s.authors = [&quot;markbates&quot;]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
   s.description = %q{configatron was developed by: markbates}
   s.email = %q{mark@markbates.com}
   s.extra_rdoc_files = [&quot;README&quot;, &quot;LICENSE&quot;]
-  s.files = [&quot;lib/configatron/configatron.rb&quot;, &quot;lib/configatron/core_ext/class.rb&quot;, &quot;lib/configatron/core_ext/kernel.rb&quot;, &quot;lib/configatron/core_ext/object.rb&quot;, &quot;lib/configatron/core_ext/string.rb&quot;, &quot;lib/configatron/errors.rb&quot;, &quot;lib/configatron/rails.rb&quot;, &quot;lib/configatron/store.rb&quot;, &quot;lib/configatron.rb&quot;, &quot;README&quot;, &quot;LICENSE&quot;, &quot;generators/configatron_generator.rb&quot;, &quot;generators/templates/configatron/cucumber.rb&quot;, &quot;generators/templates/configatron/defaults.rb&quot;, &quot;generators/templates/configatron/development.rb&quot;, &quot;generators/templates/configatron/production.rb&quot;, &quot;generators/templates/configatron/test.rb&quot;, &quot;generators/templates/initializers/configatron.rb&quot;]
+  s.files = [&quot;lib/configatron/configatron.rb&quot;, &quot;lib/configatron/core_ext/class.rb&quot;, &quot;lib/configatron/core_ext/kernel.rb&quot;, &quot;lib/configatron/core_ext/object.rb&quot;, &quot;lib/configatron/core_ext/string.rb&quot;, &quot;lib/configatron/errors.rb&quot;, &quot;lib/configatron/proc.rb&quot;, &quot;lib/configatron/rails.rb&quot;, &quot;lib/configatron/store.rb&quot;, &quot;lib/configatron.rb&quot;, &quot;README&quot;, &quot;LICENSE&quot;, &quot;generators/configatron_generator.rb&quot;, &quot;generators/templates/configatron/cucumber.rb&quot;, &quot;generators/templates/configatron/defaults.rb&quot;, &quot;generators/templates/configatron/development.rb&quot;, &quot;generators/templates/configatron/production.rb&quot;, &quot;generators/templates/configatron/test.rb&quot;, &quot;generators/templates/initializers/configatron.rb&quot;]
   s.homepage = %q{http://www.metabates.com}
   s.require_paths = [&quot;lib&quot;]
   s.rubyforge_project = %q{magrathea}</diff>
      <filename>configatron.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -8,4 +8,5 @@ require File.join(base, 'core_ext', 'kernel')
 require File.join(base, 'core_ext', 'object')
 require File.join(base, 'core_ext', 'string')
 require File.join(base, 'core_ext', 'class')
-require File.join(base, 'rails')
\ No newline at end of file
+require File.join(base, 'rails')
+require File.join(base, 'proc')
\ No newline at end of file</diff>
      <filename>lib/configatron.rb</filename>
    </modified>
    <modified>
      <diff>@@ -113,7 +113,8 @@ class Configatron
     # it won't set the value.
     def set_default(name, default_value)
       unless @_store[name.to_sym]
-        @_store[name.to_sym] = parse_options(default_value)
+        # @_store[name.to_sym] = parse_options(default_value)
+        self.send(&quot;#{name}=&quot;, default_value)
       end
     end
     
@@ -124,7 +125,15 @@ class Configatron
         raise Configatron::LockedNamespace.new(@_name) if @_locked &amp;&amp; !@_store.has_key?(name)
         @_store[name] = parse_options(*args)
       elsif @_store.has_key?(sym)
-        return @_store[sym]
+        val = @_store[sym]
+        if val.is_a?(Configatron::Proc)
+          res = val.execute
+          if val.finalize?
+            @_store[sym] = res
+          end
+          return res
+        end
+        return val
       else
         store = Configatron::Store.new({}, sym, self)
         @_store[sym] = store</diff>
      <filename>lib/configatron/store.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>88844d20a81851fe722c2c9eaaab8d0d183e1636</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </author>
  <url>http://github.com/markbates/configatron/commit/449373ddc73f6a6afc101a7ffc943dd38bcdd7ba</url>
  <id>449373ddc73f6a6afc101a7ffc943dd38bcdd7ba</id>
  <committed-date>2009-09-09T13:05:57-07:00</committed-date>
  <authored-date>2009-09-09T13:05:57-07:00</authored-date>
  <message>Added Dynamic and Delayed configurations</message>
  <tree>61c0a1eaefc2d0bfc866b6b01144b6f06bc0196a</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </committer>
</commit>
