Class: Configatron::Delayed

Inherits:
Proc show all
Defined in:
lib/configatron/proc.rb

Overview

Tells Configatron to delay execution of the block until runtime. Once run the results of the block will be cached, never to be run again.

Example:

configatron.letters = 'a-b-c-d'
configatron.my.letters = Configatron::Delayed.new do
  "My letters are: #{configatron.letters}"
end
configatron.my.other.letters = Configatron::Dynamic.new do
  "My letters are: #{configatron.a.b.c.d}"
end

configatron.my.letters # => 'My letters are: a-b-c-d'
configatron.my.other.letters # => 'My letters are: a-b-c-d'

configatron.letters = 'a-b-c-d-e'

configatron.my.letters # => 'My letters are: a-b-c-d'
configatron.my.other.letters # => 'My letters are: a-b-c-d-e'

Instance Attribute Summary

Attributes inherited from Proc

#block, #execution_count

Method Summary

Methods inherited from Proc

#execute, #finalize?, #initialize

Constructor Details

This class inherits a constructor from Configatron::Proc